diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2024-01-26 08:33:13 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-26 08:33:13 (GMT) |
| commit | 456e274578dc9863f42ab24d62adc0d8c511b50f (patch) | |
| tree | 48e67a314ec95efe6bf710f982ea9238e4b0a610 /Lib/test/datetimetester.py | |
| parent | b69548a0f52418b8a2cf7c7a885fdd7d3bfb1b0b (diff) | |
| download | cpython-456e274578dc9863f42ab24d62adc0d8c511b50f.zip cpython-456e274578dc9863f42ab24d62adc0d8c511b50f.tar.gz cpython-456e274578dc9863f42ab24d62adc0d8c511b50f.tar.bz2 | |
gh-112451: Prohibit subclassing of datetime.timezone. (#114190)
This is consistent with C-extension datetime.timezone.
Diffstat (limited to 'Lib/test/datetimetester.py')
| -rw-r--r-- | Lib/test/datetimetester.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index 8bda173..53ad5e5 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -301,6 +301,10 @@ class TestTimeZone(unittest.TestCase): self.assertIsInstance(timezone.utc, tzinfo) self.assertIsInstance(self.EST, tzinfo) + def test_cannot_subclass(self): + with self.assertRaises(TypeError): + class MyTimezone(timezone): pass + def test_utcoffset(self): dummy = self.DT for h in [0, 1.5, 12]: |
