Added test to ensure that non-string result from dst() raises TypeError.

This commit is contained in:
Tim Peters 2002-12-21 17:44:07 +00:00
parent fb8472c79c
commit b92bb71be8
1 changed files with 6 additions and 0 deletions

View File

@ -1561,6 +1561,12 @@ class TestTimeTZ(TestTime):
self.assertEqual(t1.strftime("%H:%M %%Z='%Z' %%z='%z'"),
"23:59 %Z='%z %Z %%z%%Z' %z='-2359'")
# Check that an invalid tzname result raises an exception.
class Badtzname(tzinfo):
def tzname(self, dt): return 42
t = timetz(2, 3, 4, tzinfo=Badtzname())
self.assertEqual(t.strftime("%H:%M:%S"), "02:03:04")
self.assertRaises(TypeError, t.strftime, "%Z")
def test_hash_edge_cases(self):
# Offsets that overflow a basic time.