[3.13] gh-111609: Test end_offset in SyntaxError subclass (GH-127830) (#130407)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-02-21 15:56:39 +01:00 committed by GitHub
parent 8ce48c8ebc
commit cb8d89d2e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2253,6 +2253,21 @@ class SyntaxErrorTests(unittest.TestCase):
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 = (