diff options
Diffstat (limited to 'pyflakes/test/test_other.py')
-rw-r--r-- | pyflakes/test/test_other.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py index 9c8462e..ba052f1 100644 --- a/pyflakes/test/test_other.py +++ b/pyflakes/test/test_other.py @@ -1597,6 +1597,22 @@ class TestUnusedAssignment(TestCase): except Exception%se: e ''' % as_exc) + @skipIf(version_info < (3,), + "In Python 2 exception names stay bound after the exception handler") + def test_exceptionUnusedInExcept(self): + self.flakes(''' + try: pass + except Exception as e: pass + ''', m.UnusedVariable) + + def test_exceptionUnusedInExceptInFunction(self): + as_exc = ', ' if version_info < (2, 6) else ' as ' + self.flakes(''' + def download_review(): + try: pass + except Exception%se: pass + ''' % as_exc, m.UnusedVariable) + def test_exceptWithoutNameInFunction(self): """ Don't issue false warning when an unnamed exception is used. |