From 1e11634d51640620ef19429129a60ae8b31bafd9 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Fri, 13 Jul 2018 21:08:58 +0300 Subject: [PATCH] Add a failing test for formatting Tuple[int, str, int] --- tests/test_util_inspect.py | 6 +++++- tests/typing_test_data.py | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_util_inspect.py b/tests/test_util_inspect.py index e18e21761..9558f7277 100644 --- a/tests/test_util_inspect.py +++ b/tests/test_util_inspect.py @@ -231,7 +231,7 @@ def test_Signature_partialmethod(): @pytest.mark.skipif(sys.version_info < (3, 5), reason='type annotation test is available on py35 or above') def test_Signature_annotations(): - from typing_test_data import f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11 + from typing_test_data import f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12 # Class annotations sig = inspect.Signature(f0).format_args() @@ -284,6 +284,10 @@ def test_Signature_annotations(): sig = inspect.Signature(f11, has_retval=False).format_args() assert sig == '(x: CustomAnnotation, y: 123)' + # tuple with more than two items + sig = inspect.Signature(f12).format_args() + assert sig == '() -> Tuple[int, str, int]' + def test_safe_getattr_with_default(): class Foo(object): diff --git a/tests/typing_test_data.py b/tests/typing_test_data.py index 7f82edf29..71acf1f47 100644 --- a/tests/typing_test_data.py +++ b/tests/typing_test_data.py @@ -62,3 +62,7 @@ class CustomAnnotation: def f11(x: CustomAnnotation(), y: 123) -> None: pass + + +def f12() -> Tuple[int, str, int]: + pass