From 86ce6e030b7791a430818d03c2345fef227306d8 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Sun, 22 Sep 2013 20:39:28 +0400 Subject: [PATCH] Fixed type of 'iter()' built-in function (PY-10854) --- .../PyTypeCheckerInspection/SecondFormIter.py | 16 ++++++++++++++++ .../inspections/PyTypeCheckerInspectionTest.java | 5 +++++ 2 files changed, 21 insertions(+) create mode 100644 python/testData/inspections/PyTypeCheckerInspection/SecondFormIter.py diff --git a/python/testData/inspections/PyTypeCheckerInspection/SecondFormIter.py b/python/testData/inspections/PyTypeCheckerInspection/SecondFormIter.py new file mode 100644 index 000000000000..bf0a0e80c6a2 --- /dev/null +++ b/python/testData/inspections/PyTypeCheckerInspection/SecondFormIter.py @@ -0,0 +1,16 @@ +def test_second_form(): + def f(): + return '' + + for chunk in iter(lambda: f(), ''): + pass + + +def test_second_form_fail(): + for chunk in iter(10, ''): + pass + + +def test_first_form(): + for x in iter([1, 2, 3]): + pass diff --git a/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java index f67754eb8b94..ef672f12c975 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java @@ -208,4 +208,9 @@ public class PyTypeCheckerInspectionTest extends PyTestCase { public void testStringStartsWith() { doTest(); } + + // PY-10854 + public void testSecondFormIter() { + doTest(); + } }