docstr: Run function f, with arguments args and expect an exception exc;
  when the exception is raised, check the libxml2.lastError for
  expected values.
code: def failUnlessXmlError(
      self, f, args, exc, domain, code, message, level, file, line
  ):
      """Run function f, with arguments args and expect an exception exc;
      when the exception is raised, check the libxml2.lastError for
      expected values."""
      # disable the default error handler
      libxml2.registerErrorHandler(None, None)
      try:
          f(*args)
      except exc:
          e = libxml2.lastError()
          if e is None:
              self.fail("lastError not set")
          if 0:
              print("domain = ", e.domain())
              print("code = ", e.code())
              print("message =", repr(e.message()))
              print("level =", e.level())
              print("file =", e.file())
              print("line =", e.line())
              print()
          self.failUnlessEqual(domain, e.domain())
          self.failUnlessEqual(code, e.code())
          self.failUnlessEqual(message, e.message())
          self.failUnlessEqual(level, e.level())
          self.failUnlessEqual(file, e.file())
          self.failUnlessEqual(line, e.line())
      else:
          self.fail("exception %s should have been raised" % exc)
  
file_path: turicreate/deps/src/libxml2-2.9.1/python/tests/tstLastError.py
imports: import sys, unittest
  import libxml2
label_desc: Use image node_id 4 for calling the TestCase obj's underlying member method code with example usage: obj.failUnlessXmlError(f, args, exc, domain, code, message, level, file, line) without return types