Issue #29011: Fix an important omission by adding Deque to the typing module.

This commit is contained in:
Raymond Hettinger 2017-01-16 22:42:37 -08:00
parent a105dd3dc0
commit 80490525e0
4 changed files with 41 additions and 4 deletions

View file

@ -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()