diff options
Diffstat (limited to 'Lib/test/test_syntax.py')
| -rw-r--r-- | Lib/test/test_syntax.py | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 80e36fd46e..7f7e6dafcf 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -544,7 +544,7 @@ from test import support  class SyntaxTestCase(unittest.TestCase):      def _check_error(self, code, errtext, -                     filename="<testcase>", mode="exec", subclass=None): +                     filename="<testcase>", mode="exec", subclass=None, lineno=None, offset=None):          """Check that compiling code raises SyntaxError with errtext.          errtest is a regular expression that must be present in the @@ -559,6 +559,11 @@ class SyntaxTestCase(unittest.TestCase):              mo = re.search(errtext, str(err))              if mo is None:                  self.fail("SyntaxError did not contain '%r'" % (errtext,)) +            self.assertEqual(err.filename, filename) +            if lineno is not None: +                self.assertEqual(err.lineno, lineno) +            if offset is not None: +                self.assertEqual(err.offset, offset)          else:              self.fail("compile() did not raise SyntaxError") @@ -569,7 +574,7 @@ class SyntaxTestCase(unittest.TestCase):          self._check_error("del f()", "delete")      def test_global_err_then_warn(self): -        # Bug tickler:  The SyntaxError raised for one global statement +        # Bug #763201:  The SyntaxError raised for one global statement          # shouldn't be clobbered by a SyntaxWarning issued for a later one.          source = """if 1:              def error(a): | 
