From 340649c52488c858c592a17f680992efe16dc41b Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Thu, 28 May 2020 08:49:13 +0200 Subject: Properly construct the arguments of infered property descriptors (#796) Close PyCQA/pylint#3648 --- tests/unittest_inference.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests') 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() -- cgit v1.2.1