From 2f85b1a4024d99b58705a74a179635b5bd0571b8 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 19 Mar 2022 17:10:12 +0900 Subject: test: empty tuple type is now repesented w/o args since py3.11 refs: https://github.com/python/cpython/commit/15df8f8d89a0e563bdd15e4cd6734298736a5a1d --- tests/test_util_typing.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/test_util_typing.py b/tests/test_util_typing.py index c061fa085..86fccb391 100644 --- a/tests/test_util_typing.py +++ b/tests/test_util_typing.py @@ -78,7 +78,12 @@ def test_restify_type_hints_containers(): "[:py:class:`str`, :py:class:`str`, " ":py:class:`str`]") assert restify(Tuple[str, ...]) == ":py:class:`~typing.Tuple`\\ [:py:class:`str`, ...]" - assert restify(Tuple[()]) == ":py:class:`~typing.Tuple`\\ [()]" + + if sys.version_info < (3, 11): + assert restify(Tuple[()]) == ":py:class:`~typing.Tuple`\\ [()]" + else: + assert restify(Tuple[()]) == ":py:class:`~typing.Tuple`" + assert restify(List[Dict[str, Tuple]]) == (":py:class:`~typing.List`\\ " "[:py:class:`~typing.Dict`\\ " "[:py:class:`str`, :py:class:`~typing.Tuple`]]") @@ -270,9 +275,14 @@ def test_stringify_type_hints_containers(): assert stringify(Tuple[str, ...], "fully-qualified") == "typing.Tuple[str, ...]" assert stringify(Tuple[str, ...], "smart") == "~typing.Tuple[str, ...]" - assert stringify(Tuple[()]) == "Tuple[()]" - assert stringify(Tuple[()], "fully-qualified") == "typing.Tuple[()]" - assert stringify(Tuple[()], "smart") == "~typing.Tuple[()]" + if sys.version_info < (3, 11): + assert stringify(Tuple[()]) == "Tuple[()]" + assert stringify(Tuple[()], "fully-qualified") == "typing.Tuple[()]" + assert stringify(Tuple[()], "smart") == "~typing.Tuple[()]" + else: + assert stringify(Tuple[()]) == "Tuple" + assert stringify(Tuple[()], "fully-qualified") == "typing.Tuple" + assert stringify(Tuple[()], "smart") == "~typing.Tuple" assert stringify(List[Dict[str, Tuple]]) == "List[Dict[str, Tuple]]" assert stringify(List[Dict[str, Tuple]], "fully-qualified") == "typing.List[typing.Dict[str, typing.Tuple]]" -- cgit v1.2.3