From 36e073eb9a8b3d67baecbb67c0eeed54860e4880 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Wed, 30 May 2018 13:34:47 -0700 Subject: [PATCH] add test for false warning about unused exception when using locals() --- pyflakes/test/test_other.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py index 364b3750..abf08f9b 100644 --- a/pyflakes/test/test_other.py +++ b/pyflakes/test/test_other.py @@ -1650,6 +1650,15 @@ def foo(): except (tokenize.TokenError, IndentationError): pass ''') + def test_exceptUnusedAsLocals(self): + """ + Don't issue false warning when an exception is used by locals(). + """ + self.flakes(''' + try: raise ValueError() + except ValueError as e: locals() + ''') + def test_augmentedAssignmentImportedFunctionCall(self): """ Consider a function that is called on the right part of an