Skip to content

Commit b57a7e7

Browse files
add test (why who added the suggestion for module name didn't add the traceback test?)
1 parent c01925d commit b57a7e7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Lib/test/test_traceback.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5004,6 +5004,26 @@ def func():
50045004
actual = self.get_suggestion(func)
50055005
self.assertIn("forget to import '_io'", actual)
50065006

5007+
def test_import_builtin_module_typo_suggestion(self):
5008+
def func():
5009+
import itertool # noqa: F401
5010+
5011+
actual = self.get_suggestion(func)
5012+
self.assertIn("Did you mean: 'itertools'?", actual)
5013+
5014+
def test_import_file_module_typo_suggestion(self):
5015+
def func():
5016+
import abs # noqa: F401
5017+
5018+
actual = self.get_suggestion(func)
5019+
self.assertIn("Did you mean: 'abc'?", actual)
5020+
5021+
def test_import_submodule_typo_suggestion(self):
5022+
def func():
5023+
import multiprocessing.dumy # noqa: F401
5024+
5025+
actual = self.get_suggestion(func)
5026+
self.assertIn("Did you mean: 'multiprocessing.dummy'?", actual)
50075027

50085028

50095029
class PurePythonSuggestionFormattingTests(

0 commit comments

Comments
 (0)