Fix kw-only marker getting ignored if first in the signature (#340)

Closes: #328
pull/348/head
Jeff Epler 2 years ago committed by Ashley Whetter
parent 610bd10854
commit 0ac4dc5389

@ -13,7 +13,7 @@ def _format_args(args_info, include_annotations=True, ignore_self=None):
result = []
for i, (prefix, name, annotation, default) in enumerate(args_info):
if i == 0 and name == ignore_self:
if i == 0 and ignore_self is not None and name == ignore_self:
continue
formatted = "{}{}{}{}".format(
prefix or "",

@ -181,6 +181,13 @@ class TestAstroidUtils:
sys.version_info[:2] < (3, 8), reason="Uses Python 3.8+ syntax"
),
),
pytest.param(
"*, a: int, b: int",
"*, a: int, b: int",
marks=pytest.mark.skipif(
sys.version_info[:2] < (3, 8), reason="Uses Python 3.8+ syntax"
),
),
("a: int, *args, b: str, **kwargs", "a: int, *args, b: str, **kwargs"),
("a: 'A'", "a: A"),
],

Loading…
Cancel
Save