docstr: Check that compiling code raises SyntaxError with errtext.
  
  errtext is a regular expression that must be present in the
  test of the exception raised. If subclass is specified, it
  is the expected subclass of SyntaxError (e.g. IndentationError).
docstr_tok: ["Check","that","compiling","code","raises","SyntaxError","with","errtext",".","errtext","is","a","regular","expression","that","must","be","present","in","the","test","of","the","exception","raised",".","If","subclass","is","specified",",","it","is","the","expected","subclass","of","SyntaxError","(","e.g",".","IndentationError",")","."]
code: def _check_error(
      self,
      code,
      errtext,
      filename="<testcase>",
      mode="exec",
      subclass=None,
      lineno=None,
      offset=None,
      end_lineno=None,
      end_offset=None,
  ):
      """Check that compiling code raises SyntaxError with errtext.
  
      errtext is a regular expression that must be present in the
      test of the exception raised. If subclass is specified, it
      is the expected subclass of SyntaxError (e.g. IndentationError).
      """
      try:
          compile(code, filename, mode)
      except SyntaxError as err:
          if subclass and not isinstance(err, subclass):
              self.fail("SyntaxError is not a %s" % subclass.__name__)
          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)
          if end_lineno is not None:
              self.assertEqual(err.end_lineno, end_lineno)
          if end_offset is not None:
              self.assertEqual(err.end_offset, end_offset)
  
      else:
          self.fail("compile() did not raise SyntaxError")
  
imports: import re
  import doctest
  import textwrap
  import unittest
  from test import support
label_desc: Use image node_id 1 for calling the SyntaxTestCase obj's underlying member method code with example usage: obj._check_error(code, errtext, filename, mode, subclass, lineno, offset, end_lineno, end_offset) without return types