mirror of
https://github.com/python/cpython.git
synced 2025-07-15 15:25:29 +00:00
bpo-44655: Don't include suggestions for attributes that are the same as the missing one (GH-27197) (GH-27198)
(cherry picked from commit 6714dec5e1
)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
42a5514cca
commit
a0b1d401db
3 changed files with 17 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue