diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2020-12-30 10:58:17 +0100 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2020-12-30 10:58:17 +0100 |
commit | a0d7601b6205a0c6167fdd73fc121e2acfb09856 (patch) | |
tree | 1e93111d2ba29a7389a692910937ae6562e7462f /tests/unittest_regrtest.py | |
parent | 99d9c77cc276b1c5f5d76d91282d05b5df3a2c21 (diff) | |
download | astroid-git-fix-crash-in-dunder-inference.tar.gz |
Fix a bug for dunder methods inference of function objectsfix-crash-in-dunder-inference
Fixes #819
Diffstat (limited to 'tests/unittest_regrtest.py')
-rw-r--r-- | tests/unittest_regrtest.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unittest_regrtest.py b/tests/unittest_regrtest.py index 17668edd..b75e3dfe 100644 --- a/tests/unittest_regrtest.py +++ b/tests/unittest_regrtest.py @@ -343,5 +343,16 @@ def test_ancestor_looking_up_redefined_function(): assert isinstance(found[0], nodes.FunctionDef) +def test_crash_in_dunder_inference_prevented(): + code = """ + class MyClass(): + def fu(self, objects): + delitem = dict.__delitem__.__get__(self, dict) + delitem #@ + """ + inferred = next(extract_node(code).infer()) + assert "builtins.dict.__delitem__" == inferred.qname() + + if __name__ == "__main__": unittest.main() |