Skip to content

Commit

Permalink
better naming and tests update
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Oct 15, 2024
1 parent 1aef8a1 commit 9582e97
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spacepackets/ccsds/time/cds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
6 changes: 5 additions & 1 deletion spacepackets/seqcount.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/ccsds/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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))

Expand Down

0 comments on commit 9582e97

Please sign in to comment.