Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 9, 2024
1 parent eb2e4ab commit 9de1f2e
Showing 1 changed file with 14 additions and 54 deletions.
68 changes: 14 additions & 54 deletions mypy/test/teststubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,76 +402,36 @@ def test_infer_sig_from_docstring_invalid_signature(self) -> None:

assert_equal(infer_sig_from_docstring("\nfunc() --> None", "func"), [])

assert_equal(
infer_sig_from_docstring("\nfunc(name1 name2) -> None", "func"), []
)
assert_equal(infer_sig_from_docstring("\nfunc(name1 name2) -> None", "func"), [])

assert_equal(
infer_sig_from_docstring("\nfunc(name1, name2 name3) -> None", "func"), []
)
assert_equal(infer_sig_from_docstring("\nfunc(name1, name2 name3) -> None", "func"), [])

assert_equal(
infer_sig_from_docstring("\nfunc(name2, name3) -> None, None", "func"),
[],
)
assert_equal(infer_sig_from_docstring("\nfunc(name2, name3) -> None, None", "func"), [])

assert_equal(
infer_sig_from_docstring("\nfunc(invalid::name) -> None", "func"),
[],
)
assert_equal(infer_sig_from_docstring("\nfunc(invalid::name) -> None", "func"), [])

assert_equal(
infer_sig_from_docstring("\nfunc(invalid: [type]) -> None", "func"),
[],
)
assert_equal(infer_sig_from_docstring("\nfunc(invalid: [type]) -> None", "func"), [])

assert_equal(
infer_sig_from_docstring("\nfunc(invalid: (type)) -> None", "func"),
[],
)
assert_equal(infer_sig_from_docstring("\nfunc(invalid: (type)) -> None", "func"), [])

assert_equal(
infer_sig_from_docstring("\nfunc(invalid: -type) -> None", "func"),
[],
)
assert_equal(infer_sig_from_docstring("\nfunc(invalid: -type) -> None", "func"), [])

assert_equal(
infer_sig_from_docstring("\nfunc(invalid<name) -> None", "func"),
[],
)
assert_equal(infer_sig_from_docstring("\nfunc(invalid<name) -> None", "func"), [])

assert_equal(
infer_sig_from_docstring("\nfunc(cpp::type name) -> None", "func"),
[],
)
assert_equal(
infer_sig_from_docstring("\nfunc(name) -> cpp::type", "func"),
[],
)
assert_equal(
infer_sig_from_docstring("\nvoid func(int name) {", "func"),
[],
)
assert_equal(
infer_sig_from_docstring("\nvoid func(std::vector<int> name)", "func"),
[],
)
assert_equal(infer_sig_from_docstring("\nfunc(cpp::type name) -> None", "func"), [])
assert_equal(infer_sig_from_docstring("\nfunc(name) -> cpp::type", "func"), [])
assert_equal(infer_sig_from_docstring("\nvoid func(int name) {", "func"), [])
assert_equal(infer_sig_from_docstring("\nvoid func(std::vector<int> name)", "func"), [])

def test_infer_sig_from_docstring_deeply_nested_types(self) -> None:
assert_equal(
infer_sig_from_docstring(
"\nfunc(name: dict[str, dict[str, list[tuple[int, float]]]]) -> None",
"func",
"\nfunc(name: dict[str, dict[str, list[tuple[int, float]]]]) -> None", "func"
),
[
FunctionSig(
name="func",
args=[
ArgSig(
name="name",
type="dict[str,dict[str,list[tuple[int,float]]]]",
)
],
args=[ArgSig(name="name", type="dict[str,dict[str,list[tuple[int,float]]]]")],
ret_type="None",
)
],
Expand Down

0 comments on commit 9de1f2e

Please sign in to comment.