ó úàÜdc@sddlZddlZddlZdejfd„ƒYZedkr}eƒZejƒejƒejƒej ƒndS(iÿÿÿÿNtTestCasecBs>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs|jƒ|jƒdS(N(ttest1ttest2(tself((sH/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/tstLastError.pytrunTests cCstjdƒdS(Ni(tlibxml2t debugMemory(R((sH/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/tstLastError.pytsetUp scCsRtjƒtjdƒdkrItjƒ|jdtjdƒfƒndGHdS(NiisMemory leak %d bytestOK(Rt cleanupParserRt dumpMemorytfail(R((sH/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/tstLastError.pyttearDowns    c Csüd„} tj| dƒy||ŒWn½|k rætjƒ} | dkr_|jdƒn|j|| jƒƒ|j|| jƒƒ|j|| jƒƒ|j|| j ƒƒ|j|| j ƒƒ|j| | j ƒƒnX|jd|ƒdS(sŸRun function f, with arguments args and expect an exception exc; when the exception is raised, check the libxml2.lastError for expected values.cSsdS(N((tctxtstr((sH/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/tstLastError.pytnoerrsslastError not sets$exception %s should have been raisedN( RtregisterErrorHandlertNonet lastErrorR t assertEqualtdomaintcodetmessagetleveltfiletline( RtftargstexcRRRRRRRte((sH/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/tstLastError.pytfailUnlessXmlErrors     cCsJ|jtjd tjdtjdtjdddtjdd d dƒd S( s-Test readFile with a file that does not exists dummy.xmliRRRs+failed to load external entity "dummy.xml" RRRN(s dummy.xmlNi(RRtreadFileRt treeErrort XML_FROM_IOtXML_IO_LOAD_ERRORtXML_ERR_WARNING(R((sH/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/tstLastError.pyR7s     cCsed}|jtj|t|ƒdd dftjdtjdtjdddtjd dd d ƒd S( s8Test a well-formedness error: we get the last error onlys s dummy.xmliRRRs&Premature end of data in tag x line 1 RRRiN( RRt readMemorytlenRR tXML_FROM_PARSERtXML_ERR_TAG_NOT_FINISHEDt XML_ERR_FATAL(Rts((sH/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/tstLastError.pyRCs     (t__name__t __module__RRR RRR(((sH/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/tstLastError.pyRs     t__main__( tsystunittestRRR*ttestRRRR (((sH/opt/cpanel/ea-libxml2/share/doc/libxml2/python/examples/tstLastError.pyts J