From 9582e97b9c4231acf4ff7725112b793e69b769a9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Oct 2024 15:10:44 +0200 Subject: [PATCH] better naming and tests update --- CHANGELOG.md | 4 ++++ spacepackets/ccsds/time/cds.py | 2 +- spacepackets/seqcount.py | 6 +++++- tests/ccsds/test_time.py | 6 +++--- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c00a7eb..0c2a25c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). # [unreleased] +## Changed + +Renamed `PusFileSeqCountProvider` to `CcsdsFileSeqCountProvider` but keep old alias. + # [v0.24.2] 2024-10-15 ## Fixed diff --git a/spacepackets/ccsds/time/cds.py b/spacepackets/ccsds/time/cds.py index fb1d471..2b1119b 100644 --- a/spacepackets/ccsds/time/cds.py +++ b/spacepackets/ccsds/time/cds.py @@ -35,7 +35,7 @@ class CdsShortTimestamp(CcsdsTimeProvider): and the size of the time stamp is expected to be seven bytes. >>> from spacepackets.ccsds.time import CcsdsTimeCodeId - >>> cds_short_now = CdsShortTimestamp.from_now() + >>> cds_short_now = CdsShortTimestamp.now() >>> cds_short_now.len_packed 7 >>> hex(cds_short_now.pfield[0]) diff --git a/spacepackets/seqcount.py b/spacepackets/seqcount.py index 58263b3..80bb874 100644 --- a/spacepackets/seqcount.py +++ b/spacepackets/seqcount.py @@ -85,11 +85,15 @@ def _increment_with_rollover(self, seq_cnt: int) -> int: return seq_cnt + 1 -class PusFileSeqCountProvider(FileSeqCountProvider): +class CcsdsFileSeqCountProvider(FileSeqCountProvider): def __init__(self, file_name: Path = Path("seqcnt.txt")): super().__init__(max_bit_width=14, file_name=file_name) +"""Deprecated alias: Use CcsdsFileSeqCountProvider instead""" +PusFileSeqCountProvider = CcsdsFileSeqCountProvider + + class SeqCountProvider(ProvidesSeqCount): def __init__(self, bit_width: int): self.count = 0 diff --git a/tests/ccsds/test_time.py b/tests/ccsds/test_time.py index 3a0b378..60b0029 100644 --- a/tests/ccsds/test_time.py +++ b/tests/ccsds/test_time.py @@ -20,7 +20,7 @@ def test_basic(self): ) self.assertEqual(empty_stamp.ccsds_days, 0) self.assertEqual(empty_stamp.ms_of_day, 0) - dt = empty_stamp.as_date_time() + dt = empty_stamp.as_datetime() self.assertEqual(dt.year, 1958) self.assertEqual(dt.month, 1) self.assertEqual(dt.day, 1) @@ -33,7 +33,7 @@ def test_basic(self): ) def test_basic_from_dt(self): - cds_stamp = CdsShortTimestamp.from_date_time( + cds_stamp = CdsShortTimestamp.from_datetime( datetime.datetime( year=1970, month=1, @@ -77,7 +77,7 @@ def test_addition_days_increment(self): def test_dt_is_utc(self): empty_stamp = CdsShortTimestamp(0, 0) - dt = empty_stamp.as_date_time() + dt = empty_stamp.as_datetime() self.assertEqual(dt.tzinfo, datetime.timezone.utc) self.assertEqual(dt.tzinfo.utcoffset(dt), datetime.timedelta(0))