diff options
| author | Guido van Rossum <guido@python.org> | 2015-08-05 10:13:11 (GMT) |
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 2015-08-05 10:13:11 (GMT) |
| commit | a9d77fad3491185a8c973f916314d50806e94c14 (patch) | |
| tree | 13891c54754fb43face4bc75d5fbea291572c1e3 /Lib/test | |
| parent | 71233dc3b3fb7433b79cd9d3340fe3627dc0cb07 (diff) | |
| parent | d70fe639c145c5cacfb8e4191dc736baf525b83f (diff) | |
| download | cpython-a9d77fad3491185a8c973f916314d50806e94c14.zip cpython-a9d77fad3491185a8c973f916314d50806e94c14.tar.gz cpython-a9d77fad3491185a8c973f916314d50806e94c14.tar.bz2 | |
Issue #23973: Update typing.py from GitHub repo. (Merge from 3.5.)
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_typing.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 2bb21ed..b34007d 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -459,6 +459,14 @@ class CallableTests(TestCase): ctv = Callable[..., str] self.assertEqual(repr(ctv), 'typing.Callable[..., str]') + def test_callable_with_ellipsis(self): + + def foo(a: Callable[..., T]): + pass + + self.assertEqual(get_type_hints(foo, globals(), locals()), + {'a': Callable[..., T]}) + XK = TypeVar('XK', str, bytes) XV = TypeVar('XV') @@ -555,6 +563,14 @@ class GenericTests(TestCase): with self.assertRaises(TypeError): Y[str, bytes] + def test_init(self): + T = TypeVar('T') + S = TypeVar('S') + with self.assertRaises(TypeError): + Generic[T, T] + with self.assertRaises(TypeError): + Generic[T, S, T] + def test_repr(self): self.assertEqual(repr(SimpleMapping), __name__ + '.' + 'SimpleMapping[~XK, ~XV]') @@ -801,6 +817,14 @@ class ForwardRefTests(TestCase): self.assertEqual(get_type_hints(foo, globals(), locals()), {'a': Callable[[T], T]}) + def test_callable_with_ellipsis_forward(self): + + def foo(a: 'Callable[..., T]'): + pass + + self.assertEqual(get_type_hints(foo, globals(), locals()), + {'a': Callable[..., T]}) + def test_syntax_error(self): with self.assertRaises(SyntaxError): |
