summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2020-03-28 09:52:56 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2020-03-28 09:52:56 +0100
commita50d47300b3118d7913984bb5dc018d8d3eb0967 (patch)
tree6e382fe27ed7f8ae24fb3cace34de8701c3d6fb2
parentf62be0a2d52b2ba01010cecc372fceb821528091 (diff)
downloadastroid-git-a50d47300b3118d7913984bb5dc018d8d3eb0967.tar.gz
Add posonlyargs_annotations to Arguments.as_string()
-rw-r--r--astroid/node_classes.py8
-rw-r--r--tests/unittest_scoped_nodes.py6
2 files changed, 13 insertions, 1 deletions
diff --git a/astroid/node_classes.py b/astroid/node_classes.py
index 92311d4a..db937b21 100644
--- a/astroid/node_classes.py
+++ b/astroid/node_classes.py
@@ -1644,7 +1644,13 @@ class Arguments(mixins.AssignTypeMixin, NodeNG):
positional_only_defaults = self.defaults[: len(self.defaults) - len(args)]
if self.posonlyargs:
- result.append(_format_args(self.posonlyargs, positional_only_defaults))
+ result.append(
+ _format_args(
+ self.posonlyargs,
+ positional_only_defaults,
+ self.posonlyargs_annotations,
+ )
+ )
result.append("/")
if self.args:
result.append(
diff --git a/tests/unittest_scoped_nodes.py b/tests/unittest_scoped_nodes.py
index 8dd31b8d..0c99cd13 100644
--- a/tests/unittest_scoped_nodes.py
+++ b/tests/unittest_scoped_nodes.py
@@ -1813,6 +1813,12 @@ def test_metaclass_cannot_infer_call_yields_an_instance():
pass
"""
),
+ textwrap.dedent(
+ """
+ def __init__(self: int, other: float, /, **kw):
+ pass
+ """
+ ),
],
)
@test_utils.require_version("3.8")