diff options
| author | Claudiu Popa <pcmanticore@gmail.com> | 2020-03-12 10:36:10 +0100 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2020-03-12 10:36:10 +0100 |
| commit | 6696f70e7b0e39b15a726370a4b96c24d711bd55 (patch) | |
| tree | 4e47a8389c922fc5af96953badec406e7de9cb42 | |
| parent | 381bfbef2e2af094cf38c18b34385905fdbaf271 (diff) | |
| download | astroid-git-6696f70e7b0e39b15a726370a4b96c24d711bd55.tar.gz | |
Add a regression test for inferring self in lambda
Close #425
| -rw-r--r-- | tests/unittest_regrtest.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unittest_regrtest.py b/tests/unittest_regrtest.py index 92ed5b65..2299f61b 100644 --- a/tests/unittest_regrtest.py +++ b/tests/unittest_regrtest.py @@ -306,6 +306,18 @@ def test(): ) next(node.infer()) + def test_regression_inference_of_self_in_lambda(self): + code = """ + class A: + @b(lambda self: __(self)) + def d(self): + pass + """ + node = extract_node(code) + inferred = next(node.infer()) + assert isinstance(inferred, Instance) + assert inferred.qname() == ".A" + class Whatever: a = property(lambda x: x, lambda x: x) |
