Skip to content

Commit 5ad1a90

Browse files
committed
Remove suggestions on None
1 parent 023fe8c commit 5ad1a90

2 files changed

Lines changed: 0 additions & 29 deletions

File tree

Lib/test/test_traceback.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4644,25 +4644,6 @@ def test_cross_language_mutable_on_immutable(self):
46444644
actual = self.get_suggestion(obj, attr)
46454645
self.assertEndsWith(actual, expected)
46464646

4647-
@force_not_colorized
4648-
def test_cross_language_none_suggestions(self):
4649-
# Common methods tried on None suggest the expected type
4650-
cases = [
4651-
('keys', "Did you expect a 'dict'?"),
4652-
('values', "Did you expect a 'dict'?"),
4653-
('items', "Did you expect a 'dict'?"),
4654-
('upper', "Did you expect a 'str'?"),
4655-
('lower', "Did you expect a 'str'?"),
4656-
('strip', "Did you expect a 'str'?"),
4657-
('split', "Did you expect a 'str'?"),
4658-
('sort', "Did you expect a 'list'?"),
4659-
('pop', "Did you expect a 'list' or 'dict'?"),
4660-
]
4661-
for attr, expected in cases:
4662-
with self.subTest(attr=attr):
4663-
actual = self.get_suggestion(None, attr)
4664-
self.assertEndsWith(actual, expected)
4665-
46664647
@force_not_colorized
46674648
def test_cross_language_float_bitwise(self):
46684649
# Bitwise operators on float suggest using int

Lib/traceback.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,16 +1751,6 @@ def print(self, *, file=None, chain=True, **kwargs):
17511751
"__xor__": ((float, "Did you mean to use an 'int' object? Bitwise operators are not supported by 'float'.", True),),
17521752
"__lshift__": ((float, "Did you mean to use an 'int' object? Bitwise operators are not supported by 'float'.", True),),
17531753
"__rshift__": ((float, "Did you mean to use an 'int' object? Bitwise operators are not supported by 'float'.", True),),
1754-
# NoneType -- common methods tried on None (got None instead of expected type)
1755-
"keys": ((types.NoneType, "Did you expect a 'dict'?", True),),
1756-
"values": ((types.NoneType, "Did you expect a 'dict'?", True),),
1757-
"items": ((types.NoneType, "Did you expect a 'dict'?", True),),
1758-
"upper": ((types.NoneType, "Did you expect a 'str'?", True),),
1759-
"lower": ((types.NoneType, "Did you expect a 'str'?", True),),
1760-
"strip": ((types.NoneType, "Did you expect a 'str'?", True),),
1761-
"split": ((types.NoneType, "Did you expect a 'str'?", True),),
1762-
"sort": ((types.NoneType, "Did you expect a 'list'?", True),),
1763-
"pop": ((types.NoneType, "Did you expect a 'list' or 'dict'?", True),),
17641754
})
17651755

17661756

0 commit comments

Comments
 (0)