diff options
| author | doranid <ddandd@gmail.com> | 2021-07-12 22:52:33 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-12 21:52:33 +0200 |
| commit | 820a7554b757524f938fd35091c2d8324a5b5d1c (patch) | |
| tree | bec65f4a3583eb7f2eec8a7068bd4d713becb8f4 /tests | |
| parent | 2cefda3d591f05acc9b91d3237c21b5411235794 (diff) | |
| download | astroid-git-820a7554b757524f938fd35091c2d8324a5b5d1c.tar.gz | |
Fix yield inference on inherited classes. (#1092)
* Add metadata to yield point.
* Add ChangeLog.
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 1fe83dc8..afc24dc2 100644 --- a/tests/unittest_inference.py +++ b/tests/unittest_inference.py @@ -6154,5 +6154,26 @@ def test_issue926_binop_referencing_same_name_is_not_uninferable(): assert inferred[0].value == 3 +def test_issue_1090_infer_yield_type_base_class(): + code = """ +import contextlib + +class A: + @contextlib.contextmanager + def get(self): + yield self + +class B(A): + def play(): + pass + +with B().get() as b: + b +b + """ + node = extract_node(code) + assert next(node.infer()).pytype() == ".B" + + if __name__ == "__main__": unittest.main() |
