diff options
| author | Guido van Rossum <guido@python.org> | 2016-08-23 18:01:50 (GMT) |
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 2016-08-23 18:01:50 (GMT) |
| commit | efa798d1ba08687ff68f114e905b58686dc2e5d5 (patch) | |
| tree | c39e64db5c8419b4b5ed13bddf20d37c11f8bc14 /Lib/test | |
| parent | 83f5a3846cf67e226a13f103e0b9306e8f920f2e (diff) | |
| download | cpython-efa798d1ba08687ff68f114e905b58686dc2e5d5.zip cpython-efa798d1ba08687ff68f114e905b58686dc2e5d5.tar.gz cpython-efa798d1ba08687ff68f114e905b58686dc2e5d5.tar.bz2 | |
A new version of typing.py from https://github.com/python/typing.
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_typing.py | 13 |
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) |
