bpo-38530: Match exactly AttributeError and NameError when offering suggestions (GH-25443)

diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index ebeb67b..bd20b23 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -1537,6 +1537,21 @@ def f():
 
         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.