import libxml2
else:
print "OK"
"""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:
except exc:
if e is None:
if 0:
print "domain = ",e.domain()
print "code = ",e.code()
print "level =",e.level()
print "file =",e.file()
print "line =",e.line()
print
else:
"""Test readFile with a file that does not exist"""
("dummy.xml",None,0),
file=None,
line=0)
"""Test a well-formedness error: we get the last error only"""
s = "<x>\n<a>\n</x>"
message='Premature end of data in tag x line 1\n',
line=3)
if __name__ == "__main__":