diff options
Diffstat (limited to 'pyflakes/test/test_imports.py')
-rw-r--r-- | pyflakes/test/test_imports.py | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/pyflakes/test/test_imports.py b/pyflakes/test/test_imports.py index 07504d9..fb5d2fd 100644 --- a/pyflakes/test/test_imports.py +++ b/pyflakes/test/test_imports.py @@ -1,5 +1,3 @@ -from sys import version_info - from pyflakes import messages as m from pyflakes.checker import ( FutureImportation, @@ -8,7 +6,7 @@ from pyflakes.checker import ( StarImportation, SubmoduleImportation, ) -from pyflakes.test.harness import TestCase, skip, skipIf +from pyflakes.test.harness import TestCase, skip class TestImportationObject(TestCase): @@ -577,9 +575,8 @@ class Test(TestCase): def test_redefinedByExcept(self): expected = [m.RedefinedWhileUnused] - if version_info >= (3,): - # The exc variable is unused inside the exception handler. - expected.append(m.UnusedVariable) + # The exc variable is unused inside the exception handler. + expected.append(m.UnusedVariable) self.flakes(''' import fu try: pass @@ -624,12 +621,6 @@ class Test(TestCase): self.flakes('import fu; [fu for _ in range(1)]') self.flakes('import fu; [1 for _ in range(1) if fu]') - @skipIf(version_info >= (3,), - 'in Python 3 list comprehensions execute in a separate scope') - def test_redefinedByListComp(self): - self.flakes('import fu; [1 for fu in range(1)]', - m.RedefinedInListComp) - def test_usedInTryFinally(self): self.flakes(''' import fu @@ -686,15 +677,8 @@ class Test(TestCase): def g(): foo.is_used() ''') - @skipIf(version_info >= (3,), 'deprecated syntax') - def test_usedInBackquote(self): - self.flakes('import fu; `fu`') - def test_usedInExec(self): - if version_info < (3,): - exec_stmt = 'exec "print 1" in fu.bar' - else: - exec_stmt = 'exec("print(1)", fu.bar)' + exec_stmt = 'exec("print(1)", fu.bar)' self.flakes('import fu; %s' % exec_stmt) def test_usedInLambda(self): @@ -793,8 +777,6 @@ class Test(TestCase): assert error.message == '%r imported but unused' assert error.message_args == ('from .. import *', ) - @skipIf(version_info < (3,), - 'import * below module level is a warning on Python 2') def test_localImportStar(self): """import * is only allowed at module level.""" self.flakes(''' @@ -814,17 +796,6 @@ class Test(TestCase): assert error.message == "'from %s import *' only allowed at module level" assert error.message_args == ('..', ) - @skipIf(version_info > (3,), - 'import * below module level is an error on Python 3') - def test_importStarNested(self): - """All star imports are marked as used by an undefined variable.""" - self.flakes(''' - from fu import * - def f(): - from bar import * - x - ''', m.ImportStarUsed, m.ImportStarUsed, m.ImportStarUsage) - def test_packageImport(self): """ If a dotted name is imported and used, no warning is reported. |