summaryrefslogtreecommitdiff
path: root/pylint/test/unittest_checker_python3.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2019-02-11 08:36:11 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2019-02-11 08:37:32 +0100
commit7a40b0b6d3113403a266ffef13431cdc8e6a8327 (patch)
tree1234156b8710a6ca817a72e7975d034dd4c19209 /pylint/test/unittest_checker_python3.py
parente552b81c5a61c08ff846d07611c1bae33718b49a (diff)
downloadpylint-git-7a40b0b6d3113403a266ffef13431cdc8e6a8327.tar.gz
Don't emit ``*-not-iterating`` checks for builtins consumed by ``itertools``
Close #2731
Diffstat (limited to 'pylint/test/unittest_checker_python3.py')
-rw-r--r--pylint/test/unittest_checker_python3.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/pylint/test/unittest_checker_python3.py b/pylint/test/unittest_checker_python3.py
index 623e35961..8354ed82e 100644
--- a/pylint/test/unittest_checker_python3.py
+++ b/pylint/test/unittest_checker_python3.py
@@ -177,6 +177,22 @@ class TestPython3Checker(testutils.CheckerTestCase):
with self.assertNoMessages():
self.walk(module)
+ def as_argument_to_itertools_functions(self, fxn):
+ code = """
+ from __future__ import absolute_import
+ import itertools
+ from itertools import product
+ for i,j in product({fxn}(), repeat=2):
+ pass
+ for i,j in itertools.product({fxn}(), repeat=2):
+ pass
+ """.format(
+ fxn=fxn
+ )
+ module = astroid.parse(code)
+ with self.assertNoMessages():
+ self.walk(module)
+
def as_iterable_in_unpacking(self, fxn):
node = astroid.extract_node(
"""
@@ -216,6 +232,7 @@ class TestPython3Checker(testutils.CheckerTestCase):
self.as_argument_to_materialized_filter(fxn)
self.as_iterable_in_yield_from(fxn)
self.as_iterable_in_starred_context(fxn)
+ self.as_argument_to_itertools_functions(fxn)
for func in (
"iter",