diff options
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r-- | Lib/test/test_exceptions.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index ebeb67b4512..bd20b232e54 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -1537,6 +1537,21 @@ class NameErrorTests(unittest.TestCase): self.assertNotIn("blech", err.getvalue()) + def test_unbound_local_error_doesn_not_match(self): + def foo(): + something = 3 + print(somethong) + somethong = 3 + + try: + foo() + except UnboundLocalError as exc: + with support.captured_stderr() as err: + sys.__excepthook__(*sys.exc_info()) + + self.assertNotIn("something", err.getvalue()) + + class AttributeErrorTests(unittest.TestCase): def test_attributes(self): # Setting 'attr' should not be a problem. |