diff options
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r-- | Lib/test/test_traceback.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 4864b5c..2d17e06 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -3185,6 +3185,21 @@ class SuggestionFormattingTestBase: actual = self.get_suggestion(func) self.assertNotIn("something", actual) + def test_name_error_for_stdlib_modules(self): + def func(): + stream = io.StringIO() + + actual = self.get_suggestion(func) + self.assertIn("forget to import 'io'", actual) + + def test_name_error_for_private_stdlib_modules(self): + def func(): + stream = _io.StringIO() + + actual = self.get_suggestion(func) + self.assertIn("forget to import '_io'", actual) + + class PurePythonSuggestionFormattingTests( PurePythonExceptionFormattingMixin, |