diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-03-19 22:58:15 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-03-19 22:58:15 +0900 |
commit | aa1bc83c2ac9357b39048b555c3fdb0efff3449c (patch) | |
tree | c1149670ca18b5f9820505322d5b0a5832395ea4 /tests/test_util_typing.py | |
parent | 759a526b12213c59d6ae4c8f66682f4328b764f4 (diff) | |
parent | 017ef6118b4fe588140266ad6ff2393cbddd9137 (diff) | |
download | sphinx-git-aa1bc83c2ac9357b39048b555c3fdb0efff3449c.tar.gz |
Merge branch '4.x'
Diffstat (limited to 'tests/test_util_typing.py')
-rw-r--r-- | tests/test_util_typing.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/test_util_typing.py b/tests/test_util_typing.py index 7d81fee5d..5aa558c82 100644 --- a/tests/test_util_typing.py +++ b/tests/test_util_typing.py @@ -1,12 +1,4 @@ -""" - test_util_typing - ~~~~~~~~~~~~~~~~ - - Tests util.typing functions. - - :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" +"""Tests util.typing functions.""" import sys from numbers import Integral @@ -78,7 +70,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`]]") @@ -271,9 +268,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]]" |