Skip to content

Commit

Permalink
Responding to review. New unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
chipkent committed Mar 15, 2024
1 parent 7e7e917 commit 4cf2658
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions py/server/tests/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ def test_to_j_time_zone(self):
self.assertEqual(to_j_time_zone(dttz), to_j_time_zone("UTC-5"))
self.assertEqual(to_j_time_zone(dt), to_j_time_zone("UTC-5"))

dttz = datetime.timezone(offset=-datetime.timedelta(hours=5, microseconds=10), name="XYZ")
dt = datetime.datetime(2022, 7, 7, 14, 21, 17, 123456, tzinfo=dttz)

with self.assertRaises(DHError):
to_j_time_zone(dttz)
self.fail("Expected DHError")

with self.assertRaises(DHError):
to_j_time_zone(dt)
self.fail("Expected DHError")

with self.assertRaises(TypeError):
to_j_time_zone(False)
self.fail("Expected TypeError")
Expand Down

0 comments on commit 4cf2658

Please sign in to comment.