diff options
| author | Gustavo Picon <tabo@tabo.pe> | 2012-03-21 01:02:35 -0500 |
|---|---|---|
| committer | Gustavo Picon <tabo@tabo.pe> | 2012-03-21 01:02:35 -0500 |
| commit | 48749a67fe0a8eae1493633682dcabdab6ab2953 (patch) | |
| tree | c9eaa785bb6df5c24b90dc16a1ed7b9df003bbe0 /flake8/tests | |
| parent | 5758abe37d8c96eea0003db1294022338e74bd34 (diff) | |
| download | flake8-48749a67fe0a8eae1493633682dcabdab6ab2953.tar.gz | |
Fixed the W402 (imported but unused) bug in flake8's fork of pyflakes.
Added a couple of tests that fail without this patch.
Diffstat (limited to 'flake8/tests')
| -rw-r--r-- | flake8/tests/test_flakes.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/flake8/tests/test_flakes.py b/flake8/tests/test_flakes.py index da10034..9ab3c12 100644 --- a/flake8/tests/test_flakes.py +++ b/flake8/tests/test_flakes.py @@ -28,6 +28,21 @@ except (ImportError, ValueError): print("err") """ +code_from_import_exception = """ +from foo import SomeException +try: + pass +except SomeException: + print("err") +""" + +code_import_exception = """ +import foo.SomeException +try: + pass +except foo.SomeException: + print("err") +""" class TestFlake(TestCase): @@ -35,3 +50,9 @@ class TestFlake(TestCase): for c in (code, code2, code3): warnings = check(code) self.assertEqual(warnings, 0, code) + + def test_from_import_exception_in_scope(self): + self.assertEqual(check(code_from_import_exception), 0) + + def test_import_exception_in_scope(self): + self.assertEqual(check(code_import_exception), 0) |
