summaryrefslogtreecommitdiffstats
path: root/Lib/test/datetimetester.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/datetimetester.py')
-rw-r--r--Lib/test/datetimetester.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index 48e5095..dddf0f8 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -2508,11 +2508,17 @@ class TestTimeTZ(TestTime, TZInfoBase, unittest.TestCase):
# Check that an invalid tzname result raises an exception.
class Badtzname(tzinfo):
- def tzname(self, dt): return 42
+ tz = 42
+ def tzname(self, dt): return self.tz
t = time(2, 3, 4, tzinfo=Badtzname())
self.assertEqual(t.strftime("%H:%M:%S"), "02:03:04")
self.assertRaises(TypeError, t.strftime, "%Z")
+ # Issue #6697:
+ if '_Fast' in str(type(self)):
+ Badtzname.tz = '\ud800'
+ self.assertRaises(ValueError, t.strftime, "%Z")
+
def test_hash_edge_cases(self):
# Offsets that overflow a basic time.
t1 = self.theclass(0, 1, 2, 3, tzinfo=FixedOffset(1439, ""))