summaryrefslogtreecommitdiff
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-07-16 14:16:08 -0700
committerGitHub <noreply@github.com>2021-07-16 22:16:08 +0100
commita0b1d401db52391d13479c53ee3880e6640df98c (patch)
tree72785b3d5075acf2f51228c8a2534adeadb8a891 /Lib/test/test_exceptions.py
parent42a5514cca6b4542f6b492b5652e337f15a89227 (diff)
downloadcpython-git-a0b1d401db52391d13479c53ee3880e6640df98c.tar.gz
bpo-44655: Don't include suggestions for attributes that are the same as the missing one (GH-27197) (GH-27198)
(cherry picked from commit 6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index f92637f993..a2bc62b72e 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -1916,6 +1916,18 @@ class AttributeErrorTests(unittest.TestCase):
self.assertIn("blech", err.getvalue())
+ def test_getattr_suggestions_for_same_name(self):
+ class A:
+ def __dir__(self):
+ return ['blech']
+ try:
+ A().blech
+ except AttributeError as exc:
+ with support.captured_stderr() as err:
+ sys.__excepthook__(*sys.exc_info())
+
+ self.assertNotIn("Did you mean", err.getvalue())
+
def test_attribute_error_with_failing_dict(self):
class T:
bluch = 1