Skip to content

Commit

Permalink
Updated existing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
larsbarring committed Nov 2, 2021
1 parent 1138ed6 commit 96a7591
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cf_units/tests/test_unit.py
Expand Up @@ -47,7 +47,7 @@ def test_calendar_alias(self):

def test_no_calendar(self):
u = Unit("hours since 1970-01-01 00:00:00")
self.assertEqual(u.calendar, unit.CALENDAR_GREGORIAN)
self.assertEqual(u.calendar, unit.CALENDAR_STANDARD)

def test_unsupported_calendar(self):
with self.assertRaisesRegex(ValueError, "unsupported calendar"):
Expand Down Expand Up @@ -576,9 +576,9 @@ def test___repr___basic(self):

def test___repr___time_unit(self):
u = Unit(
"hours since 2007-01-15 12:06:00", calendar=unit.CALENDAR_STANDARD
"hours since 2007-01-15 12:06:00", calendar=unit.CALENDAR_GREGORIAN
)
exp = "Unit('hours since 2007-01-15 12:06:00', calendar='gregorian')"
exp = "Unit('hours since 2007-01-15 12:06:00', calendar='standard')"
self.assertEqual(repr(u), exp)


Expand Down Expand Up @@ -949,11 +949,11 @@ def test_decode_time(self):
class TestNumsAndDates(unittest.TestCase):
def test_num2date(self):
u = Unit(
"hours since 2010-11-02 12:00:00", calendar=unit.CALENDAR_STANDARD
"hours since 2010-11-02 12:00:00", calendar=unit.CALENDAR_GREGORIAN
)
res = u.num2date(1)
self.assertEqual(str(res), "2010-11-02 13:00:00")
self.assertEqual(res.calendar, "gregorian")
self.assertEqual(res.calendar, "standard")
self.assertIsInstance(res, cftime.datetime)

def test_num2date_py_datetime_type(self):
Expand Down

0 comments on commit 96a7591

Please sign in to comment.