mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-112451: Prohibit subclassing of datetime.timezone. (#114190)
This is consistent with C-extension datetime.timezone.
This commit is contained in:
parent
b69548a0f5
commit
456e274578
3 changed files with 9 additions and 0 deletions
|
@ -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]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue