summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2020-05-28 08:49:13 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2020-05-28 08:49:44 +0200
commit340649c52488c858c592a17f680992efe16dc41b (patch)
treedf88baf51fa90d23e718e117973acc4d1ce72f1d /tests
parentb339a0ee17c15f7be23dee0c981edf64f0e65f33 (diff)
downloadastroid-git-340649c52488c858c592a17f680992efe16dc41b.tar.gz
Properly construct the arguments of infered property descriptors (#796)
Close PyCQA/pylint#3648
Diffstat (limited to 'tests')
-rw-r--r--tests/unittest_inference.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py
index cfbcd6f8..d99298bc 100644
--- a/tests/unittest_inference.py
+++ b/tests/unittest_inference.py
@@ -5846,5 +5846,22 @@ def test_super_inference_of_abstract_property():
assert len(test) == 2
+def test_infer_generated_setter():
+ code = """
+ class A:
+ @property
+ def test(self):
+ pass
+ A.test.setter
+ """
+ node = extract_node(code)
+ inferred = next(node.infer())
+ assert isinstance(inferred, nodes.FunctionDef)
+ assert isinstance(inferred.args, nodes.Arguments)
+ # This line used to crash because property generated functions
+ # did not have args properly set
+ assert list(inferred.nodes_of_class(nodes.Const)) == []
+
+
if __name__ == "__main__":
unittest.main()