summaryrefslogtreecommitdiff
path: root/tests/unittest_nodes.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2020-06-09 22:02:48 +0200
committerGitHub <noreply@github.com>2020-06-09 22:02:48 +0200
commit1cf413ff986cf464202a07df60e7bd54695ed0e0 (patch)
tree65ecd70f5d6057047403122e9f01158038f22637 /tests/unittest_nodes.py
parentca821aacd3d27b118781de77463238aa58f1f3ca (diff)
downloadastroid-git-1cf413ff986cf464202a07df60e7bd54695ed0e0.tar.gz
`FunctionDef.is_generator` properly handles `yield` nodes in `If` tests (#799)
Close PyCQA/pylint#3583
Diffstat (limited to 'tests/unittest_nodes.py')
-rw-r--r--tests/unittest_nodes.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py
index 07733e5f..5b6a39e3 100644
--- a/tests/unittest_nodes.py
+++ b/tests/unittest_nodes.py
@@ -1347,5 +1347,18 @@ def test_is_generator_for_yield_in_while():
assert bool(node.is_generator())
+def test_is_generator_for_yield_in_if():
+ code = """
+ import asyncio
+
+ def paused_iter(iterable):
+ if (yield from asyncio.sleep(0.01)):
+ pass
+ return
+ """
+ node = astroid.extract_node(code)
+ assert bool(node.is_generator())
+
+
if __name__ == "__main__":
unittest.main()