diff options
author | Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> | 2023-04-22 11:27:19 +0200 |
---|---|---|
committer | Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> | 2023-04-22 11:48:05 +0200 |
commit | b670d91328e70a51833eaa109f62c5fe6acc3089 (patch) | |
tree | 5c27b9d9cf6343962285cfee0596d870ea19e4b1 /tests | |
parent | 687afe0308e73f22a49dd0eec65c9cae2c06e55e (diff) | |
download | astroid-git-b670d91328e70a51833eaa109f62c5fe6acc3089.tar.gz |
Fix constructors of ``FunctionDef``
Co-authored-by: Nick Drozd <nicholasdrozd@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_scoped_nodes.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/test_scoped_nodes.py b/tests/test_scoped_nodes.py index d3a890ab..3795df56 100644 --- a/tests/test_scoped_nodes.py +++ b/tests/test_scoped_nodes.py @@ -2915,7 +2915,14 @@ def test_deprecation_of_doc_attribute() -> None: node_class = nodes.ClassDef(name="MyClass") node_class.postinit(bases=[], body=[], decorators=[], doc_node=doc_node) assert node_class.doc_node == doc_node - node_func = nodes.FunctionDef(name="MyFunction") + node_func = nodes.FunctionDef( + name="MyFunction", + lineno=0, + col_offset=0, + parent=node_module, + end_lineno=0, + end_col_offset=0, + ) node_func.postinit( args=nodes.Arguments(parent=node_func, vararg=None, kwarg=None), body=[], @@ -2940,5 +2947,12 @@ def test_deprecation_of_doc_attribute() -> None: with pytest.warns(DeprecationWarning) as records: node_module = nodes.Module(name="MyModule", doc="Docstring") node_class = nodes.ClassDef(name="MyClass", doc="Docstring") - node_func = nodes.FunctionDef(name="MyFunction", doc="Docstring") - assert len(records) == 3 + node_func = nodes.FunctionDef( + name="MyFunction", + lineno=0, + col_offset=0, + parent=node_module, + end_lineno=0, + end_col_offset=0, + ) + assert len(records) == 2 |