Dennis Sweeney <[email protected]> added the comment:
Another idea: do what test_exceptions() does:
try:
f()
except NameError as exc:
with support.captured_stderr() as err:
sys.__excepthook__(*sys.exc_info())
self.assertNotIn("a1", err.getvalue())
Then instead of the assert, do something like
last_line = err.getvalue().rsplit("\n", 2)[-2]
_, did_you_mean, suggestion = last_line.rpartition("Did you mean: ")
if did_you_mean:
print(did_you_mean + suggestion)
This can probably be done without test.support.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue44026>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com