diff options
| author | Claudiu Popa <pcmanticore@gmail.com> | 2021-01-01 15:41:46 +0100 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2021-01-01 16:25:26 +0100 |
| commit | c9fd1934e9c49d9052f64439fc7ea82026bce00f (patch) | |
| tree | a4c31596cb5f9cd013fbb1c53924a4d403235a1f /tests | |
| parent | 58212bd459269da1b9cbf20ff23c3738f4d3dc3d (diff) | |
| download | astroid-git-c9fd1934e9c49d9052f64439fc7ea82026bce00f.tar.gz | |
``is_generator`` correctly considers `Yield` nodes in `AugAssign` nodes
This fixes a false positive with the `assignment-from-no-return` pylint check.
Close PyCQA/pylint#3904
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unittest_nodes.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py index 5b6a39e3..d138ee17 100644 --- a/tests/unittest_nodes.py +++ b/tests/unittest_nodes.py @@ -1360,5 +1360,16 @@ def test_is_generator_for_yield_in_if(): assert bool(node.is_generator()) +def test_is_generator_for_yield_in_aug_assign(): + code = """ + def test(): + buf = '' + while True: + buf += yield + """ + node = astroid.extract_node(code) + assert bool(node.is_generator()) + + if __name__ == "__main__": unittest.main() |
