Skip to content

Commit 6dc6612

Browse files
committed
Update tests
1 parent fce7867 commit 6dc6612

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

Lib/test/test_traceback.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4176,14 +4176,14 @@ class CaseChangeOverSubstitution:
41764176
BLuch = None
41774177

41784178
for cls, suggestion in [
4179-
(Addition, "'bluchin'?"),
4180-
(Substitution, "'blech'?"),
4181-
(Elimination, "'blch'?"),
4182-
(Addition, "'bluchin'?"),
4183-
(SubstitutionOverElimination, "'blach'?"),
4184-
(SubstitutionOverAddition, "'blach'?"),
4185-
(EliminationOverAddition, "'bluc'?"),
4186-
(CaseChangeOverSubstitution, "'BLuch'?"),
4179+
(Addition, "'.bluchin'"),
4180+
(Substitution, "'.blech'"),
4181+
(Elimination, "'.blch'"),
4182+
(Addition, "'.bluchin'"),
4183+
(SubstitutionOverElimination, "'.blach'"),
4184+
(SubstitutionOverAddition, "'.blach'"),
4185+
(EliminationOverAddition, "'.bluc'"),
4186+
(CaseChangeOverSubstitution, "'.BLuch'"),
41874187
]:
41884188
actual = self.get_suggestion(cls(), 'bluch')
41894189
self.assertIn(suggestion, actual)
@@ -4192,23 +4192,23 @@ def test_suggestions_underscored(self):
41924192
class A:
41934193
bluch = None
41944194

4195-
self.assertIn("'bluch'", self.get_suggestion(A(), 'blach'))
4196-
self.assertIn("'bluch'", self.get_suggestion(A(), '_luch'))
4197-
self.assertIn("'bluch'", self.get_suggestion(A(), '_bluch'))
4195+
self.assertIn("'.bluch'", self.get_suggestion(A(), 'blach'))
4196+
self.assertIn("'.bluch'", self.get_suggestion(A(), '_luch'))
4197+
self.assertIn("'.bluch'", self.get_suggestion(A(), '_bluch'))
41984198

41994199
attr_function = self.attr_function
42004200
class B:
42014201
_bluch = None
42024202
def method(self, name):
42034203
attr_function(self, name)
42044204

4205-
self.assertIn("'_bluch'", self.get_suggestion(B(), '_blach'))
4206-
self.assertIn("'_bluch'", self.get_suggestion(B(), '_luch'))
4207-
self.assertNotIn("'_bluch'", self.get_suggestion(B(), 'bluch'))
4205+
self.assertIn("'._bluch'", self.get_suggestion(B(), '_blach'))
4206+
self.assertIn("'._bluch'", self.get_suggestion(B(), '_luch'))
4207+
self.assertNotIn("'._bluch'", self.get_suggestion(B(), 'bluch'))
42084208

4209-
self.assertIn("'_bluch'", self.get_suggestion(partial(B().method, '_blach')))
4210-
self.assertIn("'_bluch'", self.get_suggestion(partial(B().method, '_luch')))
4211-
self.assertIn("'_bluch'", self.get_suggestion(partial(B().method, 'bluch')))
4209+
self.assertIn("'._bluch'", self.get_suggestion(partial(B().method, '_blach')))
4210+
self.assertIn("'._bluch'", self.get_suggestion(partial(B().method, '_luch')))
4211+
self.assertIn("'._bluch'", self.get_suggestion(partial(B().method, 'bluch')))
42124212

42134213

42144214
def test_do_not_trigger_for_long_attributes(self):
@@ -4256,7 +4256,7 @@ class A:
42564256
fiⁿₐˡᵢᶻₐᵗᵢᵒₙ = None
42574257

42584258
suggestion = self.get_suggestion(A(), 'fiⁿₐˡᵢᶻₐᵗᵢᵒₙ')
4259-
self.assertIn("'finalization'", suggestion)
4259+
self.assertIn("'.finalization'", suggestion)
42604260
self.assertNotIn("analization", suggestion)
42614261

42624262
class B:
@@ -4371,11 +4371,11 @@ def __init__(self):
43714371

43724372
# Should suggest 'inner.value'
43734373
actual = self.get_suggestion(Outer(), 'value')
4374-
self.assertIn("Did you mean: 'inner.value'", actual)
4374+
self.assertIn("Did you mean '.inner.value' instead of '.value'", actual)
43754375

43764376
# Should suggest 'inner.data'
43774377
actual = self.get_suggestion(Outer(), 'data')
4378-
self.assertIn("Did you mean: 'inner.data'", actual)
4378+
self.assertIn("Did you mean '.inner.data' instead of '.value'", actual)
43794379

43804380
def test_getattr_nested_prioritizes_direct_matches(self):
43814381
# Test that direct attribute matches are prioritized over nested ones
@@ -4390,7 +4390,7 @@ def __init__(self):
43904390

43914391
# Should suggest 'fooo' (direct) not 'inner.foo' (nested)
43924392
actual = self.get_suggestion(Outer(), 'foo')
4393-
self.assertIn("Did you mean: 'fooo'", actual)
4393+
self.assertIn("Did you mean '.fooo'", actual)
43944394
self.assertNotIn("inner.foo", actual)
43954395

43964396
def test_getattr_nested_with_property(self):
@@ -4487,7 +4487,7 @@ def __init__(self):
44874487

44884488
# Should suggest only the first match (alphabetically)
44894489
actual = self.get_suggestion(Outer(), 'value')
4490-
self.assertIn("'a_inner.value'", actual)
4490+
self.assertIn("'.a_inner.value'", actual)
44914491
# Verify it's a single suggestion, not multiple
44924492
self.assertEqual(actual.count("Did you mean"), 1)
44934493

@@ -4510,10 +4510,10 @@ def __init__(self):
45104510
self.exploder = ExplodingProperty() # Accessing attributes will raise
45114511
self.safe_inner = SafeInner()
45124512

4513-
# Should still suggest 'safe_inner.target' without crashing
4513+
# Should still suggest '.safe_inner.target' without crashing
45144514
# even though accessing exploder.target would raise an exception
45154515
actual = self.get_suggestion(Outer(), 'target')
4516-
self.assertIn("'safe_inner.target'", actual)
4516+
self.assertIn("'.safe_inner.target'", actual)
45174517

45184518
def test_getattr_nested_handles_hasattr_exceptions(self):
45194519
# Test that exceptions in hasattr don't crash the system
@@ -4534,7 +4534,7 @@ def __init__(self):
45344534

45354535
# Should still find 'normal.target' even though weird.target check fails
45364536
actual = self.get_suggestion(Outer(), 'target')
4537-
self.assertIn("'normal.target'", actual)
4537+
self.assertIn("'.normal.target'", actual)
45384538

45394539
def make_module(self, code):
45404540
tmpdir = Path(tempfile.mkdtemp())

0 commit comments

Comments
 (0)