@@ -168,7 +168,7 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
168
168
pytest .param (str , ":py:class:`str`" , id = "str" ),
169
169
pytest .param (int , ":py:class:`int`" , id = "int" ),
170
170
pytest .param (StringIO , ":py:class:`~io.StringIO`" , id = "StringIO" ),
171
- pytest .param (FunctionType , ":py:class :`~types.FunctionType`" , id = "FunctionType" ),
171
+ pytest .param (FunctionType , ":py:data :`~types.FunctionType`" , id = "FunctionType" ),
172
172
pytest .param (ModuleType , ":py:class:`~types.ModuleType`" , id = "ModuleType" ),
173
173
pytest .param (type (None ), ":py:obj:`None`" , id = "type None" ),
174
174
pytest .param (type , ":py:class:`type`" , id = "type" ),
@@ -257,7 +257,7 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
257
257
id = "Union-str-Any" ,
258
258
),
259
259
pytest .param (
260
- Optional [str ], # noqa: UP007
260
+ Optional [str ],
261
261
r":py:data:`~typing.Optional`\ \[:py:class:`str`]" ,
262
262
id = "Optional-str" ,
263
263
),
@@ -267,7 +267,7 @@ def test_parse_annotation(annotation: Any, module: str, class_name: str, args: t
267
267
id = "Optional-str-None" ,
268
268
),
269
269
pytest .param (
270
- Optional [str | bool ], # noqa: UP007
270
+ Optional [str | bool ],
271
271
r":py:data:`~typing.Union`\ \[:py:class:`str`, :py:class:`bool`, :py:obj:`None`]" ,
272
272
id = "Optional-Union-str-bool" ,
273
273
),
@@ -414,7 +414,7 @@ def test_format_annotation(inv: Inventory, annotation: Any, expected_result: str
414
414
assert format_annotation (annotation , conf ) == expected_result
415
415
416
416
# Test for the correct role (class vs data) using the official Sphinx inventory
417
- if "typing" in expected_result :
417
+ if any ( modname in expected_result for modname in ( "typing" , "types" )) :
418
418
m = re .match (r"^:py:(?P<role>class|data|func):`~(?P<name>[^`]+)`" , result )
419
419
assert m , "No match"
420
420
name = m .group ("name" )
0 commit comments