summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@dropbox.com>2016-08-23 18:06:30 (GMT)
committerGuido van Rossum <guido@dropbox.com>2016-08-23 18:06:30 (GMT)
commit1f5beb7a6e1e6c2418d87917315573ae73c8845e (patch)
treec137adb34831d5e0d8226931580d672942970062 /Lib/test
parentf0666949fda1f418eb656b7503b4609e6bd58163 (diff)
parentefa798d1ba08687ff68f114e905b58686dc2e5d5 (diff)
downloadcpython-1f5beb7a6e1e6c2418d87917315573ae73c8845e.zip
cpython-1f5beb7a6e1e6c2418d87917315573ae73c8845e.tar.gz
cpython-1f5beb7a6e1e6c2418d87917315573ae73c8845e.tar.bz2
A new version of typing.py from https://github.com/python/typing. (Merge 3.5->3.6)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_typing.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index a7f8dd5..72afe67 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -512,6 +512,10 @@ class CallableTests(BaseTestCase):
self.assertEqual(get_type_hints(foo, globals(), locals()),
{'a': Callable[..., T]})
+ def test_ellipsis_in_generic(self):
+ # Shouldn't crash; see https://github.com/python/typing/issues/259
+ typing.List[Callable[..., str]]
+
XK = TypeVar('XK', str, bytes)
XV = TypeVar('XV')
@@ -852,7 +856,7 @@ class VarianceTests(BaseTestCase):
def test_covariance_sequence(self):
# Check covariance for Sequence (which is just a generic class
- # for this purpose, but using a covariant type variable).
+ # for this purpose, but using a type variable with covariant=True).
self.assertIsSubclass(typing.Sequence[Manager],
typing.Sequence[Employee])
self.assertNotIsSubclass(typing.Sequence[Employee],
@@ -1185,6 +1189,13 @@ class CollectionsAbcTests(BaseTestCase):
self.assertIsInstance([], typing.Container)
self.assertNotIsInstance(42, typing.Container)
+ def test_collection(self):
+ if hasattr(typing, 'Collection'):
+ self.assertIsInstance(tuple(), typing.Collection)
+ self.assertIsInstance(frozenset(), typing.Collection)
+ self.assertIsSubclass(dict, typing.Collection)
+ self.assertNotIsInstance(42, typing.Collection)
+
def test_abstractset(self):
self.assertIsInstance(set(), typing.AbstractSet)
self.assertNotIsInstance(42, typing.AbstractSet)