Skip to content

Commit b43366e

Browse files
committed
update dtype handling for windows
1 parent 06be080 commit b43366e

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

gnss_lib_py/utils/time_conversions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def unix_millis_to_datetime(unix_millis):
274274
t_utc : datetime.datetime
275275
UTC time as a datetime object.
276276
"""
277-
if np.issubdtype(type(unix_millis),int):
277+
if np.issubdtype(type(unix_millis),int) or isinstance(unix_millis,np.ndarray):
278278
unix_millis = float(unix_millis)
279279
t_utc = UNIX_EPOCH_0 + timedelta(milliseconds=unix_millis)
280280
t_utc = t_utc.replace(tzinfo=timezone.utc)

tests/parsers/test_navdata.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def test_replace_mapper_all(df_simple, rows):
575575
np.array([10,2,46,67,98,300]))
576576

577577
assert new_navdata["names"].dtype == object
578-
assert new_navdata["integers"].dtype == int
578+
assert np.issubdtype(new_navdata["integers"].dtype, int)
579579
assert new_navdata["floats"].dtype == np.float64
580580
assert new_navdata["strings"].dtype == object
581581

@@ -589,7 +589,7 @@ def test_replace_mapper_all(df_simple, rows):
589589
np.array([10,2,46,67,98,300]))
590590

591591
assert data_temp["names"].dtype == object
592-
assert data_temp["integers"].dtype == int
592+
assert np.issubdtype(data_temp["integers"].dtype, int)
593593
assert data_temp["floats"].dtype == np.float64
594594
assert data_temp["strings"].dtype == object
595595

@@ -634,7 +634,7 @@ def test_replace_mapper_partial(df_simple, rows):
634634
np.array([10,2,45,67,98,300]))
635635

636636
assert new_navdata["names"].dtype == object
637-
assert new_navdata["integers"].dtype == int
637+
assert np.issubdtype(new_navdata["integers"].dtype, int)
638638
assert new_navdata["floats"].dtype == np.float64
639639
assert new_navdata["strings"].dtype == object
640640

@@ -648,7 +648,7 @@ def test_replace_mapper_partial(df_simple, rows):
648648
np.array([10,2,45,67,98,300]))
649649

650650
assert data_temp["names"].dtype == object
651-
assert data_temp["integers"].dtype == int
651+
assert np.issubdtype(data_temp["integers"].dtype, int)
652652
assert data_temp["floats"].dtype == np.float64
653653
assert data_temp["strings"].dtype == object
654654

@@ -692,7 +692,7 @@ def test_replace_mapper_type_change(df_simple):
692692
assert data["names"].dtype == object
693693
assert data["integers"].dtype == object
694694
assert data["floats"].dtype == np.float64
695-
assert data["strings"].dtype == int
695+
assert np.issubdtype(data["strings"].dtype, int)
696696

697697
def test_rename_mapper_and_rows(df_simple):
698698
"""Test data renaming functionality with type changes and row names.

tests/utils/test_time_conversions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ def test_datetime_to_unix_millis():
206206
t_rev = tc.unix_millis_to_datetime(out_unix_millis)
207207
assert t_datetime == t_rev
208208

209+
t_rev = tc.unix_millis_to_datetime(np.array(out_unix_millis).astype(np.int64))
210+
assert t_datetime == t_rev
211+
209212

210213
def test_datetime_to_gps_millis():
211214
"""Test UTC datetime to milliseconds since GPS epoch conversion

0 commit comments

Comments
 (0)