diff options
Diffstat (limited to 'pyflakes/test/test_other.py')
-rw-r--r-- | pyflakes/test/test_other.py | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py index 97685ef..b138cf6 100644 --- a/pyflakes/test/test_other.py +++ b/pyflakes/test/test_other.py @@ -21,37 +21,6 @@ class Test(TestCase): f() ''', m.UndefinedLocal, m.UnusedVariable) - @skipIf(version_info >= (3,), - 'in Python 3 list comprehensions execute in a separate scope') - def test_redefinedInListComp(self): - """ - Test that shadowing a variable in a list comprehension raises - a warning. - """ - self.flakes(''' - a = 1 - [1 for a, b in [(1, 2)]] - ''', m.RedefinedInListComp) - self.flakes(''' - class A: - a = 1 - [1 for a, b in [(1, 2)]] - ''', m.RedefinedInListComp) - self.flakes(''' - def f(): - a = 1 - [1 for a, b in [(1, 2)]] - ''', m.RedefinedInListComp) - self.flakes(''' - [1 for a, b in [(1, 2)]] - [1 for a, b in [(1, 2)]] - ''') - self.flakes(''' - for a, b in [(1, 2)]: - pass - [1 for a, b in [(1, 2)]] - ''') - def test_redefinedInGenerator(self): """ Test that reusing a variable in a generator does not raise @@ -239,21 +208,6 @@ class Test(TestCase): [a for a in '12'] ''') - @skipIf(version_info >= (3,), - 'in Python 3 list comprehensions execute in a separate scope') - def test_redefinedElseInListComp(self): - """ - Test that shadowing a variable in a list comprehension in - an else (or if) block raises a warning. - """ - self.flakes(''' - if False: - pass - else: - a = 1 - [a for a in '12'] - ''', m.RedefinedInListComp) - def test_functionDecorator(self): """ Test that shadowing a function definition with a decorated version of @@ -394,7 +348,6 @@ class Test(TestCase): yield ''', m.YieldOutsideFunction) - @skipIf(version_info < (3, 3), "Python >= 3.3 only") def test_classWithYieldFrom(self): """ If a yield from is used inside a class, a warning is emitted. @@ -404,7 +357,6 @@ class Test(TestCase): yield from range(10) ''', m.YieldOutsideFunction) - @skipIf(version_info < (3, 3), "Python >= 3.3 only") def test_moduleWithYieldFrom(self): """ If a yield from is used at the module level, a warning is emitted. @@ -903,7 +855,6 @@ class Test(TestCase): pass ''', m.DefaultExceptNotLast, m.DefaultExceptNotLast) - @skipIf(version_info < (3,), "Python 3 only") def test_starredAssignmentNoError(self): """ Python 3 extended iterable unpacking @@ -957,7 +908,6 @@ class Test(TestCase): ", *rest] = range(1<<8)" self.flakes(s) - @skipIf(version_info < (3, ), "Python 3 only") def test_starredAssignmentErrors(self): """ SyntaxErrors (not encoded in the ast) surrounding Python 3 extended @@ -1185,7 +1135,6 @@ class Test(TestCase): pass ''') - @skipIf(version_info < (3, 3), "Python >= 3.3 only") def test_function_arguments_python3(self): self.flakes(''' def foo(a, b, c=0, *args, d=0, **kwargs): @@ -1276,7 +1225,6 @@ class TestUnusedAssignment(TestCase): b = 1 ''') - @skipIf(version_info < (3,), 'new in Python 3') def test_assignToNonlocal(self): """ Assigning to a nonlocal and then not using that binding is perfectly @@ -1660,8 +1608,6 @@ class TestUnusedAssignment(TestCase): except Exception as e: e ''') - @skipIf(version_info < (3,), - "In Python 2 exception names stay bound after the exception handler") def test_exceptionUnusedInExcept(self): self.flakes(''' try: pass @@ -1754,7 +1700,6 @@ class TestUnusedAssignment(TestCase): assert 1 ''') - @skipIf(version_info < (3, 3), 'new in Python 3.3') def test_yieldFromUndefined(self): """ Test C{yield from} statement @@ -1764,7 +1709,6 @@ class TestUnusedAssignment(TestCase): yield from foo() ''', m.UndefinedName) - @skipIf(version_info < (3, 6), 'new in Python 3.6') def test_f_string(self): """Test PEP 498 f-strings are treated as a usage.""" self.flakes(''' @@ -1801,7 +1745,6 @@ class TestUnusedAssignment(TestCase): class TestStringFormatting(TestCase): - @skipIf(version_info < (3, 6), 'new in Python 3.6') def test_f_string_without_placeholders(self): self.flakes("f'foo'", m.FStringMissingPlaceholders) self.flakes(''' @@ -1939,7 +1882,6 @@ class TestStringFormatting(TestCase): '%*.*f' % (5, 2, 3.1234) ''') - @skipIf(version_info < (3, 5), 'new in Python 3.5') def test_ok_percent_format_cannot_determine_element_count(self): self.flakes(''' a = [] @@ -1954,28 +1896,24 @@ class TestStringFormatting(TestCase): class TestAsyncStatements(TestCase): - @skipIf(version_info < (3, 5), 'new in Python 3.5') def test_asyncDef(self): self.flakes(''' async def bar(): return 42 ''') - @skipIf(version_info < (3, 5), 'new in Python 3.5') def test_asyncDefAwait(self): self.flakes(''' async def read_data(db): await db.fetch('SELECT ...') ''') - @skipIf(version_info < (3, 5), 'new in Python 3.5') def test_asyncDefUndefined(self): self.flakes(''' async def bar(): return foo() ''', m.UndefinedName) - @skipIf(version_info < (3, 5), 'new in Python 3.5') def test_asyncFor(self): self.flakes(''' async def read_data(db): @@ -1985,7 +1923,6 @@ class TestAsyncStatements(TestCase): return output ''') - @skipIf(version_info < (3, 5), 'new in Python 3.5') def test_asyncForUnderscoreLoopVar(self): self.flakes(''' async def coro(it): @@ -1993,7 +1930,6 @@ class TestAsyncStatements(TestCase): pass ''') - @skipIf(version_info < (3, 5), 'new in Python 3.5') def test_loopControlInAsyncFor(self): self.flakes(''' async def read_data(db): @@ -2015,7 +1951,6 @@ class TestAsyncStatements(TestCase): return output ''') - @skipIf(version_info < (3, 5), 'new in Python 3.5') def test_loopControlInAsyncForElse(self): self.flakes(''' async def read_data(db): @@ -2037,7 +1972,6 @@ class TestAsyncStatements(TestCase): return output ''', m.BreakOutsideLoop) - @skipIf(version_info < (3, 5), 'new in Python 3.5') @skipIf(version_info > (3, 8), "Python <= 3.8 only") def test_continueInAsyncForFinally(self): self.flakes(''' @@ -2051,7 +1985,6 @@ class TestAsyncStatements(TestCase): return output ''', m.ContinueInFinally) - @skipIf(version_info < (3, 5), 'new in Python 3.5') def test_asyncWith(self): self.flakes(''' async def commit(session, data): @@ -2059,7 +1992,6 @@ class TestAsyncStatements(TestCase): await session.update(data) ''') - @skipIf(version_info < (3, 5), 'new in Python 3.5') def test_asyncWithItem(self): self.flakes(''' async def commit(session, data): @@ -2069,14 +2001,12 @@ class TestAsyncStatements(TestCase): await trans.end() ''') - @skipIf(version_info < (3, 5), 'new in Python 3.5') def test_matmul(self): self.flakes(''' def foo(a, b): return a @ b ''') - @skipIf(version_info < (3, 6), 'new in Python 3.6') def test_formatstring(self): self.flakes(''' hi = 'hi' |