Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
nineteendo committed Dec 3, 2024
1 parent 6f5ef28 commit 204cd8d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Lib/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2195,6 +2195,22 @@ def test_range_of_offsets(self):
self.assertIn(expected, err.getvalue())
the_exception = exc

def test_subclass(self):
class MySyntaxError(SyntaxError):
pass

try:
raise MySyntaxError("bad bad", ("bad.py", 1, 2, "abcdefg", 1, 7))
except SyntaxError as exc:
with support.captured_stderr() as err:
sys.__excepthook__(*sys.exc_info())
self.assertIn("""
File "bad.py", line 1
abcdefg
^^^^^
""", err.getvalue())


def test_encodings(self):
self.addCleanup(unlink, TESTFN)
source = (
Expand Down

0 comments on commit 204cd8d

Please sign in to comment.