diff options
| author | Claudiu Popa <pcmanticore@gmail.com> | 2020-02-27 10:24:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-27 10:24:42 +0100 |
| commit | 5bde219644af11bc44458b95443974fa50958e95 (patch) | |
| tree | 101173180bebe62313eb6c7a3b75ec49b22727f8 /tests | |
| parent | 597c044378bdcac0e02205e151f180f85a40a729 (diff) | |
| download | astroid-git-5bde219644af11bc44458b95443974fa50958e95.tar.gz | |
Infer qualified ``classmethod`` as a classmethod. (#759)
Close PyCQA/pylint#3417
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unittest_inference.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py index 008e3d1f..0a0b5a66 100644 --- a/tests/unittest_inference.py +++ b/tests/unittest_inference.py @@ -5534,5 +5534,26 @@ def test_inferaugassign_picking_parent_instead_of_stmt(): assert inferred.name == "SomeClass" +def test_classmethod_from_builtins_inferred_as_bound(): + code = """ + import builtins + + class Foo(): + @classmethod + def bar1(cls, text): + pass + + @builtins.classmethod + def bar2(cls, text): + pass + + Foo.bar1 #@ + Foo.bar2 #@ + """ + first_node, second_node = extract_node(code) + assert isinstance(next(first_node.infer()), BoundMethod) + assert isinstance(next(second_node.infer()), BoundMethod) + + if __name__ == "__main__": unittest.main() |
