Skip to content

Commit 0565da6

Browse files
committed
Fix testcases that failed in python3.10.0b4
1 parent 42d9d11 commit 0565da6

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

tests/test_util_inspect.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,8 @@ def test_signature_annotations():
215215

216216
# optional union
217217
sig = inspect.signature(f20)
218-
if sys.version_info < (3, 7):
219-
assert stringify_signature(sig) in ('() -> Optional[Union[int, str]]',
220-
'() -> Optional[Union[str, int]]')
221-
else:
222-
assert stringify_signature(sig) == '() -> Optional[Union[int, str]]'
218+
assert stringify_signature(sig) in ('() -> Optional[Union[int, str]]',
219+
'() -> Optional[Union[str, int]]')
223220

224221
# Any
225222
sig = inspect.signature(f14)

tests/test_util_typing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ def test_restify_type_Literal():
142142

143143
@pytest.mark.skipif(sys.version_info < (3, 10), reason='python 3.10+ is required.')
144144
def test_restify_type_union_operator():
145-
assert restify(int | None) == "Optional[:class:`int`]" # type: ignore
145+
assert restify(int | None) == ":class:`int` | :obj:`None`" # type: ignore
146146
assert restify(int | str) == ":class:`int` | :class:`str`" # type: ignore
147-
assert restify(int | str | None) == "Optional[:class:`int` | :class:`str`]" # type: ignore
147+
assert restify(int | str | None) == ":class:`int` | :class:`str` | :obj:`None`" # type: ignore
148148

149149

150150
def test_restify_broken_type_hints():
@@ -253,9 +253,9 @@ def test_stringify_type_Literal():
253253

254254
@pytest.mark.skipif(sys.version_info < (3, 10), reason='python 3.10+ is required.')
255255
def test_stringify_type_union_operator():
256-
assert stringify(int | None) == "Optional[int]" # type: ignore
256+
assert stringify(int | None) == "int | None" # type: ignore
257257
assert stringify(int | str) == "int | str" # type: ignore
258-
assert stringify(int | str | None) == "Optional[int | str]" # type: ignore
258+
assert stringify(int | str | None) == "int | str | None" # type: ignore
259259

260260

261261
def test_stringify_broken_type_hints():

0 commit comments

Comments
 (0)