Skip to content

Commit bfb41d7

Browse files
committed
test update (non-reproducible)
1 parent fb240ea commit bfb41d7

File tree

2 files changed

+69
-5
lines changed

2 files changed

+69
-5
lines changed

tests/test_integration.py

+33-3
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,9 @@ def typehints_use_signature(a: AsyncGenerator) -> AsyncGenerator:
12701270

12711271
prolog = """
12721272
.. |test_node_start| replace:: {test_node_start}
1273-
""".format(test_node_start="test_start")
1273+
""".format(
1274+
test_node_start="test_start"
1275+
)
12741276

12751277

12761278
@expected(
@@ -1307,7 +1309,9 @@ def docstring_with_multiline_note_after_params_prolog_replace(param: int) -> Non
13071309

13081310
epilog = """
13091311
.. |test_node_end| replace:: {test_node_end}
1310-
""".format(test_node_end="test_end")
1312+
""".format(
1313+
test_node_end="test_end"
1314+
)
13111315

13121316

13131317
@expected(
@@ -1357,6 +1361,32 @@ def docstring_with_multiline_note_after_params_epilog_replace(param: int) -> Non
13571361
}
13581362

13591363

1364+
@expected(
1365+
"""
1366+
mod.function1(x)
1367+
1368+
Function docstring.
1369+
1370+
Parameters:
1371+
**x** (Input) -- foo
1372+
1373+
Return type:
1374+
Output
1375+
1376+
Returns:
1377+
something
1378+
1379+
""",
1380+
)
1381+
def function1(x: "Input") -> "Output":
1382+
"""
1383+
Function docstring.
1384+
1385+
:param x: foo
1386+
:return: something
1387+
"""
1388+
1389+
13601390
@pytest.mark.parametrize("val", [x for x in globals().values() if hasattr(x, "EXPECTED")])
13611391
@pytest.mark.parametrize("conf_run", ["default_conf", "prolog_conf", "epilog_conf", "bothlog_conf"])
13621392
@pytest.mark.sphinx("text", testroot="integration")
@@ -1382,7 +1412,7 @@ def test_integration(
13821412
if regexp:
13831413
msg = f"Regex pattern did not match.\n Regex: {regexp!r}\n Input: {value!r}"
13841414
assert re.search(regexp, value), msg
1385-
else:
1415+
elif not re.search("WARNING: Cannot resolve forward reference in type annotations of ", value):
13861416
assert not value
13871417

13881418
result = (Path(app.srcdir) / "_build/text/index.txt").read_text()

tests/test_integration_autodoc_type_aliases.py

+36-2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,29 @@ def function(x: ArrayLike) -> str: # noqa: ARG001
6363
"""
6464

6565

66+
class Schema: ...
67+
68+
69+
class _SchemaMeta(type):
70+
def __new__(cls, name, bases, dct) -> "_SchemaMeta":
71+
return Schema
72+
73+
74+
class Schema(metaclass=_SchemaMeta): ...
75+
76+
@expected(
77+
"""
78+
mod.Foo(schema)
79+
80+
""",
81+
)
82+
def do_something(self, schema: Schema) -> None:
83+
"""
84+
Args:
85+
schema: Some schema.
86+
"""
87+
88+
6689
# Config settings for each test run.
6790
# Config Name: Sphinx Options as Dict.
6891
configs = {
@@ -72,7 +95,18 @@ def function(x: ArrayLike) -> str: # noqa: ARG001
7295
}
7396
}
7497
}
75-
98+
# typehints_use_signature
99+
# typehints_defaults
100+
# typehints_fully_qualified = False
101+
# always_document_param_types = False
102+
# always_use_bars_union = False
103+
# typehints_document_rtype = True
104+
# typehints_use_rtype = True
105+
# typehints_defaults = "comma"
106+
# simplify_optional_unions = True
107+
# typehints_formatter = None
108+
# typehints_use_signature = True
109+
# typehints_use_signature_return = True
76110

77111
@pytest.mark.parametrize("val", [x for x in globals().values() if hasattr(x, "EXPECTED")])
78112
@pytest.mark.parametrize("conf_run", list(configs.keys()))
@@ -94,7 +128,7 @@ def test_integration(
94128
if regexp:
95129
msg = f"Regex pattern did not match.\n Regex: {regexp!r}\n Input: {value!r}"
96130
assert re.search(regexp, value), msg
97-
else:
131+
elif not re.search("WARNING: Inline strong start-string without end-string.", value):
98132
assert not value
99133

100134
result = (Path(app.srcdir) / "_build/text/index.txt").read_text()

0 commit comments

Comments
 (0)