diff options
| author | Claudiu Popa <pcmanticore@gmail.com> | 2020-03-07 16:54:59 +0100 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2020-03-07 16:54:59 +0100 |
| commit | 04f5853b42f3c886fc7a3b553e32f1d1bf21419b (patch) | |
| tree | 668f217fdb9666fd2fb638c46c9a01405195606d /tests | |
| parent | 7120d894635662d49b05c0cc5d664b5a25544605 (diff) | |
| download | astroid-git-04f5853b42f3c886fc7a3b553e32f1d1bf21419b.tar.gz | |
Do not infer the first argument of a staticmethod in a metaclass as the class itself
Close PyCQA/pylint#3032
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unittest_inference.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py index 7f86de4d..f9e95e40 100644 --- a/tests/unittest_inference.py +++ b/tests/unittest_inference.py @@ -5743,5 +5743,17 @@ def test_getattr_fails_on_empty_values(): inferred.getattr("") +def test_infer_first_argument_of_static_method_in_metaclass(): + code = """ + class My(type): + @staticmethod + def test(args): + args #@ + """ + node = extract_node(code) + inferred = next(node.infer()) + assert inferred is util.Uninferable + + if __name__ == "__main__": unittest.main() |
