mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #29011: Fix an important omission by adding Deque to the typing module.
This commit is contained in:
parent
a105dd3dc0
commit
80490525e0
4 changed files with 41 additions and 4 deletions
|
@ -1572,6 +1572,9 @@ class CollectionsAbcTests(BaseTestCase):
|
|||
def test_list(self):
|
||||
self.assertIsSubclass(list, typing.List)
|
||||
|
||||
def test_deque(self):
|
||||
self.assertIsSubclass(collections.deque, typing.Deque)
|
||||
|
||||
def test_set(self):
|
||||
self.assertIsSubclass(set, typing.Set)
|
||||
self.assertNotIsSubclass(frozenset, typing.Set)
|
||||
|
@ -1642,6 +1645,14 @@ class CollectionsAbcTests(BaseTestCase):
|
|||
self.assertIsSubclass(MyDefDict, collections.defaultdict)
|
||||
self.assertNotIsSubclass(collections.defaultdict, MyDefDict)
|
||||
|
||||
def test_no_deque_instantiation(self):
|
||||
with self.assertRaises(TypeError):
|
||||
typing.Deque()
|
||||
with self.assertRaises(TypeError):
|
||||
typing.Deque[T]()
|
||||
with self.assertRaises(TypeError):
|
||||
typing.Deque[int]()
|
||||
|
||||
def test_no_set_instantiation(self):
|
||||
with self.assertRaises(TypeError):
|
||||
typing.Set()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue