mirror of https://github.com/python/cpython.git
Added test to ensure that non-string result from dst() raises TypeError.
This commit is contained in:
parent
fb8472c79c
commit
b92bb71be8
|
@ -1561,6 +1561,12 @@ def test_zones(self):
|
|||
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.
|
||||
|
|
Loading…
Reference in New Issue