mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
[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:
parent
8ce48c8ebc
commit
cb8d89d2e4
1 changed files with 15 additions and 0 deletions
|
@ -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 = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue