Skip to content
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
686051c
fix(traceback): TracebackException to handle error messages with punc…
krisztian-gajdar Aug 24, 2025
8331ee9
revert unrelated changes
krisztian-gajdar Aug 24, 2025
15c22ab
revert unrelated changes
krisztian-gajdar Aug 24, 2025
f3a91fe
refactor: rename and simplify error suggestion handling
krisztian-gajdar Aug 26, 2025
c22677e
test: add test_exception_punctuation_handling_with_suggestions
krisztian-gajdar Aug 29, 2025
5849913
test: add test_exception_punctuation_handling_with_suggestions
krisztian-gajdar Aug 29, 2025
09b17d2
refactor: review items
krisztian-gajdar Aug 30, 2025
de43049
test: extend error suggestion punctuation handling tests
krisztian-gajdar Aug 30, 2025
28e6e5a
test: new traceback test cases
krisztian-gajdar Aug 30, 2025
aeb7632
refactor traceback tests
krisztian-gajdar Sep 7, 2025
dc0d6b5
Merge branch 'main' into traceback-to-handle-error-msgs-with-period
krisztian-gajdar Oct 31, 2025
632f5eb
fix: remove suggestion prompts from exception error messages
krisztian-gajdar Nov 2, 2025
d859b9f
Merge branch 'main' into traceback-to-handle-error-msgs-with-period
krisztian-gajdar Nov 2, 2025
fa624e1
Merge branch 'main' into traceback-to-handle-error-msgs-with-period
krisztian-gajdar Nov 3, 2025
fc54425
Merge branch 'main' into traceback-to-handle-error-msgs-with-period
krisztian-gajdar Dec 16, 2025
0e306a6
Merge branch 'main' into traceback-to-handle-error-msgs-with-period
krisztian-gajdar Jan 26, 2026
77e6a19
Merge branch 'main' into traceback-to-handle-error-msgs-with-period
krisztian-gajdar Feb 9, 2026
ccf70c1
refactor(traceback): consolidate ModuleNotFoundError handling and fix…
krisztian-gajdar Feb 9, 2026
05f4932
Merge branch 'main' into traceback-to-handle-error-msgs-with-period
krisztian-gajdar Feb 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: new traceback test cases
  • Loading branch information
krisztian-gajdar committed Aug 30, 2025
commit 28e6e5aa361caa620ae5fcc6ed4c972974c85d46
15 changes: 14 additions & 1 deletion Lib/test/test_traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -3803,7 +3803,7 @@ def test_traceback_header(self):
self.assertEqual(list(exc.format()), ["Exception: haven\n"])

def test_name_error_punctuation_with_suggestions(self):
def raise_mssage(message, name):
def raise_mssage(message, name, name_from=None):
Comment thread
krisztian-gajdar marked this conversation as resolved.
Outdated
try:
raise NameError(message, name=name)
Comment thread
krisztian-gajdar marked this conversation as resolved.
Outdated
except NameError as e:
Expand All @@ -3822,6 +3822,19 @@ def raise_mssage(message, name):
messsage = raise_mssage(message, name)
Comment thread
krisztian-gajdar marked this conversation as resolved.
Outdated
self.assertEqual(messsage, expected)

with self.subTest("combined suggestion"):
Comment thread
krisztian-gajdar marked this conversation as resolved.
Outdated
messsage = raise_mssage("foo", "abc")
expected_message = (
"NameError: foo. Did you mean: 'abs'? "
"Or did you forget to import 'abc'?\n"
)
self.assertEqual(messsage, expected_message)

with self.subTest("'did you mean' suggestion"):
messsage = raise_mssage("bar", "flaot")
expected_message = "NameError: bar. Did you mean: 'float'?\n"
self.assertEqual(messsage, expected_message)

def test_import_error_punctuation_handling_with_suggestions(self):
def raise_mssage(message):
Comment thread
krisztian-gajdar marked this conversation as resolved.
Outdated
try:
Expand Down
Loading