Show More
@@ -0,0 +1,5 b'' | |||
|
1 | Support for PEP-678 Exception Notes | |
|
2 | ----------------------------------- | |
|
3 | ||
|
4 | Ultratb now shows :pep:`678` notes, improving your debugging experience on | |
|
5 | Python 3.11+ or with libraries such as Pytest and Hypothesis. |
@@ -363,6 +363,29 b' def r3o2():' | |||
|
363 | 363 | ip.run_cell("r3o2()") |
|
364 | 364 | |
|
365 | 365 | |
|
366 | class PEP678NotesReportingTest(unittest.TestCase): | |
|
367 | ERROR_WITH_NOTE = """ | |
|
368 | try: | |
|
369 | raise AssertionError("Message") | |
|
370 | except Exception as e: | |
|
371 | try: | |
|
372 | e.add_note("This is a PEP-678 note.") | |
|
373 | except AttributeError: # Python <= 3.10 | |
|
374 | e.__notes__ = ("This is a PEP-678 note.",) | |
|
375 | raise | |
|
376 | """ | |
|
377 | ||
|
378 | def test_verbose_reports_notes(self): | |
|
379 | with tt.AssertPrints(["AssertionError", "Message", "This is a PEP-678 note."]): | |
|
380 | ip.run_cell(self.ERROR_WITH_NOTE) | |
|
381 | ||
|
382 | def test_plain_reports_notes(self): | |
|
383 | with tt.AssertPrints(["AssertionError", "Message", "This is a PEP-678 note."]): | |
|
384 | ip.run_cell("%xmode Plain") | |
|
385 | ip.run_cell(self.ERROR_WITH_NOTE) | |
|
386 | ip.run_cell("%xmode Verbose") | |
|
387 | ||
|
388 | ||
|
366 | 389 | #---------------------------------------------------------------------------- |
|
367 | 390 | |
|
368 | 391 | # module testing (minimal) |
General Comments 0
You need to be logged in to leave comments.
Login now