diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-03-19 16:56:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-19 16:56:42 +0300 |
commit | 838964bd4925721eb92e0497a8ea5321458c6217 (patch) | |
tree | 1464ac6ee084654368f74ac3c887f3e0560a3b00 | |
parent | ce5537c980bf28fa44944aeeab68a3c80fd85762 (diff) | |
parent | 2f85b1a4024d99b58705a74a179635b5bd0571b8 (diff) |
Merge pull request #10272 from tk0miya/py311_Tuple4.4.x
test: empty tuple type is now repesented w/o args since py3.11
-rw-r--r-- | tests/test_util_typing.py | 18 |
1 files 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]]" |