diff --git a/py/server/tests/test_time.py b/py/server/tests/test_time.py index 2864c4cd0ba..907638ca081 100644 --- a/py/server/tests/test_time.py +++ b/py/server/tests/test_time.py @@ -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")