Skip to content

Commit 838964b

Browse files
authored
Merge pull request #10272 from tk0miya/py311_Tuple
test: empty tuple type is now repesented w/o args since py3.11
2 parents ce5537c + 2f85b1a commit 838964b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

tests/test_util_typing.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ def test_restify_type_hints_containers():
7878
"[:py:class:`str`, :py:class:`str`, "
7979
":py:class:`str`]")
8080
assert restify(Tuple[str, ...]) == ":py:class:`~typing.Tuple`\\ [:py:class:`str`, ...]"
81-
assert restify(Tuple[()]) == ":py:class:`~typing.Tuple`\\ [()]"
81+
82+
if sys.version_info < (3, 11):
83+
assert restify(Tuple[()]) == ":py:class:`~typing.Tuple`\\ [()]"
84+
else:
85+
assert restify(Tuple[()]) == ":py:class:`~typing.Tuple`"
86+
8287
assert restify(List[Dict[str, Tuple]]) == (":py:class:`~typing.List`\\ "
8388
"[:py:class:`~typing.Dict`\\ "
8489
"[:py:class:`str`, :py:class:`~typing.Tuple`]]")
@@ -270,9 +275,14 @@ def test_stringify_type_hints_containers():
270275
assert stringify(Tuple[str, ...], "fully-qualified") == "typing.Tuple[str, ...]"
271276
assert stringify(Tuple[str, ...], "smart") == "~typing.Tuple[str, ...]"
272277

273-
assert stringify(Tuple[()]) == "Tuple[()]"
274-
assert stringify(Tuple[()], "fully-qualified") == "typing.Tuple[()]"
275-
assert stringify(Tuple[()], "smart") == "~typing.Tuple[()]"
278+
if sys.version_info < (3, 11):
279+
assert stringify(Tuple[()]) == "Tuple[()]"
280+
assert stringify(Tuple[()], "fully-qualified") == "typing.Tuple[()]"
281+
assert stringify(Tuple[()], "smart") == "~typing.Tuple[()]"
282+
else:
283+
assert stringify(Tuple[()]) == "Tuple"
284+
assert stringify(Tuple[()], "fully-qualified") == "typing.Tuple"
285+
assert stringify(Tuple[()], "smart") == "~typing.Tuple"
276286

277287
assert stringify(List[Dict[str, Tuple]]) == "List[Dict[str, Tuple]]"
278288
assert stringify(List[Dict[str, Tuple]], "fully-qualified") == "typing.List[typing.Dict[str, typing.Tuple]]"

0 commit comments

Comments
 (0)