ó {G_Tc@s–ddlZddlZddlZddlmZddlmZddlmZm Z dej fd„ƒYZ dZ dej fd „ƒYZ d ej fd „ƒYZd ej fd „ƒYZdej fd„ƒYZdej fd„ƒYZdej fd„ƒYZdej fd„ƒYZdej fd„ƒYZdej fd„ƒYZdej fd„ƒYZd„Zedkr’eƒndS(iÿÿÿÿN(texpat(t test_support(tsortdictt run_unittesttSetAttributeTestcBs,eZd„Zd„Zd„Zd„ZRS(cCsFtjddƒ|_ddgddgddgddgg|_dS(Ntnamespace_separatort!iii(Rt ParserCreatetparsert set_get_pairs(tself((s-/usr/local/lib/python2.7/test/test_pyexpat.pytsetUps    cCs@x9|jD].\}}||j_|j|jj|ƒq WdS(N(R Rtreturns_unicodet assertEqual(R txty((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_returns_unicodes cCs@x9|jD].\}}||j_|j|jj|ƒq WdS(N(R Rtordered_attributesR (R RR((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_ordered_attributess cCs@x9|jD].\}}||j_|j|jj|ƒq WdS(N(R Rtspecified_attributesR (R RR((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_specified_attributes!s (t__name__t __module__R RRR(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR s  sn %unparsed_entity; ]> Contents of subelements &external_entity; t ParseTestcBsoeZddd„ƒYZdddddddd d d d d ddgZd„Zd„Zd„Zd„ZRS(t OutputtercBs˜eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zd„Zd„ZRS(cCs g|_dS(N(tout(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyt__init__AscCs,|jjdt|ƒdt|ƒƒdS(NsStart element: t (RtappendtreprR(R tnametattrs((s-/usr/local/lib/python2.7/test/test_pyexpat.pytStartElementHandlerDscCs|jjdt|ƒƒdS(Ns End element: (RRR(R R((s-/usr/local/lib/python2.7/test/test_pyexpat.pytEndElementHandlerHscCs3|jƒ}|r/|jjdt|ƒƒndS(NsCharacter data: (tstripRRR(R tdata((s-/usr/local/lib/python2.7/test/test_pyexpat.pytCharacterDataHandlerKs cCs,|jjdt|ƒdt|ƒƒdS(NsPI: R(RRR(R ttargetR#((s-/usr/local/lib/python2.7/test/test_pyexpat.pytProcessingInstructionHandlerPscCs,|jjdt|ƒdt|ƒƒdS(Ns NS decl: R(RRR(R tprefixturi((s-/usr/local/lib/python2.7/test/test_pyexpat.pytStartNamespaceDeclHandlerSscCs|jjdt|ƒƒdS(NsEnd of NS decl: (RRR(R R'((s-/usr/local/lib/python2.7/test/test_pyexpat.pytEndNamespaceDeclHandlerVscCs|jjdƒdS(NsStart of CDATA section(RR(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pytStartCdataSectionHandlerYscCs|jjdƒdS(NsEnd of CDATA section(RR(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pytEndCdataSectionHandler\scCs|jjdt|ƒƒdS(Ns Comment: (RRR(R ttext((s-/usr/local/lib/python2.7/test/test_pyexpat.pytCommentHandler_scGs-|\}}}}|jjd|fƒdS(NsNotation declared: %s(RR(R targsRtbasetsysidtpubid((s-/usr/local/lib/python2.7/test/test_pyexpat.pytNotationDeclHandlerbscGs0|\}}}}}|jjd|fƒdS(NsUnparsed entity decl: %s(RR(R R/t entityNameR0tsystemIdtpublicIdt notationName((s-/usr/local/lib/python2.7/test/test_pyexpat.pytUnparsedEntityDeclHandlerfscCs|jjdƒdS(NsNot standalonei(RR(R tuserData((s-/usr/local/lib/python2.7/test/test_pyexpat.pytNotStandaloneHandlerjscGs1|\}}}}|jjd|dfƒdS(NsExternal entity ref: %si(RR(R R/tcontextR0tsysIdtpubId((s-/usr/local/lib/python2.7/test/test_pyexpat.pytExternalEntityRefHandlernscCsdS(N((R R9((s-/usr/local/lib/python2.7/test/test_pyexpat.pytDefaultHandlersscCsdS(N((R R9((s-/usr/local/lib/python2.7/test/test_pyexpat.pytDefaultHandlerExpandvs(RRRR R!R$R&R)R*R+R,R.R3R8R:R>R?R@(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR@s                R R!R$R&R8R3R)R*R.R+R,R?R@R>cCsÅ|jƒ}tjddƒ}x*|jD]}t||t||ƒƒq(Wd|_|jtdƒ|j }|j |ddƒ|j |ddƒ|j |ddƒ|j |d d ƒ|j |d d ƒ|j |d dƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |dd ƒ|j |d!d"ƒ|j |d#d$ƒdS(%NRRiis,PI: 'xml-stylesheet' 'href="stylesheet.css"'sComment: ' comment data 'is<Notation declared: ('notation', None, 'notation.jpeg', None)isPUnparsed entity decl: ('unparsed_entity', None, 'entity.file', None, 'notation')isHStart element: 'root' {'attr1': 'value1', 'attr2': 'value2\xe1\xbd\x80'}is1NS decl: 'myns' 'http://www.python.org/namespace'is>Start element: 'http://www.python.org/namespace!subelement' {}is)Character data: 'Contents of subelements'is9End element: 'http://www.python.org/namespace!subelement'i sEnd of NS decl: 'myns'i sStart element: 'sub2' {}i sStart of CDATA sectioni s+Character data: 'contents of CDATA section'i sEnd of CDATA sectionisEnd element: 'sub2'is0External entity ref: (None, 'entity.file', None)isEnd element: 'root'( RRRt handler_namestsetattrtgetattrR tParseR#RR (R RRRtop((s-/usr/local/lib/python2.7/test/test_pyexpat.pyt test_utf8…s0   cCsÅ|jƒ}tjddƒ}d|_x*|jD]}t||t||ƒƒq1W|jtdƒ|j }|j |ddƒ|j |ddƒ|j |ddƒ|j |d d ƒ|j |d d ƒ|j |d dƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |dd ƒ|j |d!d"ƒ|j |d#d$ƒdS(%NRRiis.PI: u'xml-stylesheet' u'href="stylesheet.css"'sComment: u' comment data 'is>Notation declared: (u'notation', None, u'notation.jpeg', None)isSUnparsed entity decl: (u'unparsed_entity', None, u'entity.file', None, u'notation')isGStart element: u'root' {u'attr1': u'value1', u'attr2': u'value2\u1f40'}is3NS decl: u'myns' u'http://www.python.org/namespace'is?Start element: u'http://www.python.org/namespace!subelement' {}is*Character data: u'Contents of subelements'is:End element: u'http://www.python.org/namespace!subelement'i sEnd of NS decl: u'myns'i sStart element: u'sub2' {}i sStart of CDATA sectioni s,Character data: u'contents of CDATA section'i sEnd of CDATA sectionisEnd element: u'sub2'is1External entity ref: (None, u'entity.file', None)isEnd element: u'root'( RRRR RARBRCRDR#RR (R RRRRE((s-/usr/local/lib/python2.7/test/test_pyexpat.pyt test_unicode¢s0   cCs4|jƒ}tjddƒ}d|_x*|jD]}t||t||ƒƒq1Wtjtƒ}|j |ƒ|j }|j |ddƒ|j |ddƒ|j |ddƒ|j |d d ƒ|j |d d ƒ|j |d dƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |ddƒ|j |dd ƒ|j |d!d"ƒ|j |d#d$ƒt t jd%ƒ}z=|jƒtjƒ}|jtƒ|j |ƒWdQXWdt jt jƒXdS(&NRRiis.PI: u'xml-stylesheet' u'href="stylesheet.css"'sComment: u' comment data 'is>Notation declared: (u'notation', None, u'notation.jpeg', None)isSUnparsed entity decl: (u'unparsed_entity', None, u'entity.file', None, u'notation')isGStart element: u'root' {u'attr1': u'value1', u'attr2': u'value2\u1f40'}is3NS decl: u'myns' u'http://www.python.org/namespace'is?Start element: u'http://www.python.org/namespace!subelement' {}is*Character data: u'Contents of subelements'is:End element: u'http://www.python.org/namespace!subelement'i sEnd of NS decl: u'myns'i sStart element: u'sub2' {}i sStart of CDATA sectioni s,Character data: u'contents of CDATA section'i sEnd of CDATA sectionisEnd element: u'sub2'is1External entity ref: (None, u'entity.file', None)isEnd element: u'root'twb(RRRR RARBRCtStringIOR#t ParseFileRR topenRtTESTFNtcloset assertRaisest ValueErrortunlink(R RRRtfileREtfp((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_parse_file¿s@      cCsytjƒ}tjtƒ}|j|ƒ|jtjƒ}|j|ƒWdQX|jtj|j j ƒtj j ƒdS(N( RRRIR#RJRNterrorR t ErrorStringt exceptiontcodeterrorstXML_ERROR_FINISHED(R RRQtcm((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_parse_againçs  ((RRRRARFRGRSR[(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR?s:    (tNamespaceSeparatorTestcBs#eZd„Zd„Zd„ZRS(cCs.tjƒtjddƒtjddƒdS(NRR(RRtNone(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyt test_legalôs cCs˜ytjddƒ|jƒWn)tk rI}|jt|ƒdƒnXytjddƒ|jƒWn)tk r“}|jt|ƒdƒnXdS(NRi*s9ParserCreate() argument 2 must be string or None, not intstoo longsCnamespace_separator must be at most one character, omitted, or None(RRtfailt TypeErrorR tstrRO(R te((s-/usr/local/lib/python2.7/test/test_pyexpat.pyt test_illegalûs cCstjddƒdS(NRt(RR(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_zero_length s (RRR^RcRe(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR\ós  t InterningTestcBseZd„ZRS(cs‹tjƒ}g‰‡fd†}||_||_|jddƒˆd}|jtˆƒdƒx!ˆD]}|j||kƒqjWdS(Ncsˆj|ƒdS(N(R(RR/(tL(s-/usr/local/lib/python2.7/test/test_pyexpat.pyt collectorss iii(RRR R!RDR tlent assertTrue(R tpRhttagtentry((Rgs-/usr/local/lib/python2.7/test/test_pyexpat.pyttests     (RRRn(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyRfstBufferTextTestcBs›eZd„Zd„Zd„Zd„Zd„Zd„Zgd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zd„Zd„ZRS(cCs7g|_tjƒ|_d|j_|j|j_dS(Ni(tstuffRRRt buffer_textR$(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR (s  c Cs3|j|j|d||jtt|ƒfƒdS(Ns%s stuff = %r expected = %r(R Rptmaptunicode(R texpectedtlabel((s-/usr/local/lib/python2.7/test/test_pyexpat.pytcheck.scCs|jj|ƒdS(N(RpR(R R-((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR$3scCs]|jjd|ƒ|jdƒ}|dkr>d|j_n|dkrYd|j_ndS(Ns<%s>s buffer-texttyesitnoi(RpRtgetRRq(R RRtbt((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR 6s   cCs|jjd|ƒdS(Ns(RpR(R R((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR!>scCs|jjd|ƒdS(Ns (RpR(R R#((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR.AscCs1x*|D]"}t|j|t||ƒƒqWdS(N(RBRRC(R thandlersR((s-/usr/local/lib/python2.7/test/test_pyexpat.pyt setHandlersDs cCs tjƒ}|j|jƒdS(N(RRt assertFalseRq(R R((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_default_to_disabledHs cCsC|j|jjƒ|jjddƒ|j|jdgdƒdS(Ns123it123s$buffered text not properly collapsed(RjRRqRDR Rp(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_buffering_enabledLsc CsU|jdgƒ|jjddƒ|j|jdddddd d d gd ƒdS( NR s912 34 5ist1st2s t3ss4 5s*buffering control not reacting as expected(R|RRDR Rp(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest1Ss  cCs0|jjddƒ|j|jdgdƒdS(Ns&1<2> 3is1<2> 3s$buffered text not properly collapsed(RRDR Rp(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest2\scCsO|jdgƒ|jjddƒ|j|jdddddd gd ƒdS( NR s123isRsR‚sRƒs buffered text not properly split(R|RRDR Rp(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest3as!cCs[|jddgƒd|j_|jjddƒ|j|jddddd d gƒdS( NR R!s123issssss(R|R]RR$RDR Rp(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest4gs   c CsX|jddgƒ|jjddƒ|j|jddddd d d d d g ƒdS(NR R!s123isRssR‚ssRƒs(R|RRDR Rp(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest5ns c Cs^|jdddgƒ|jjddƒ|j|jdddd d d d d dg dƒdS(NR.R!R s12345 isRssR‚sst345ss buffered text not properly split(R|RRDR Rp(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest6ts    cCsj|jdddgƒ|jjddƒ|j|jdddd d d d d dddddg dƒdS(NR.R!R s,12345 isRssR‚ssRƒs t4s t5ss buffered text not properly split(R|RRDR Rp(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest7|s   (RRR RvR$R R!R.R|R~R€R„R…R†R‡RˆRŠR(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyRo's               tHandlerExceptionTestcBseZd„Zd„ZRS(cCst|ƒ‚dS(N(t RuntimeError(R RR((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR ˆscCsytjƒ}|j|_y|jddƒ|jƒWn<tk rt}|j|jdddd|jdƒnXdS(Nsiitas*Expected RuntimeError for element 'a', buts found %r(RRR RDR_RR R/(R RRb((s-/usr/local/lib/python2.7/test/test_pyexpat.pyRn‹s  (RRR Rn(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyRއs t PositionTestcBs,eZd„Zd„Zd„Zd„ZRS(cCs|jdƒdS(Nts(t check_pos(R RR((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR ™scCs|jdƒdS(NRb(R“(R R((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR!œscCs†||jj|jj|jjf}|j|jt|jƒkdƒ|j|j}|j||d||fƒ|jd7_dS(Nstoo many parser eventss%Expected position %s, got position %si( RtCurrentByteIndextCurrentLineNumbertCurrentColumnNumberRjtuptoRit expected_listR (R teventtposRt((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR“Ÿs   c Csntjƒ|_|j|j_|j|j_d|_ddddddg|_d}|jj|dƒdS(NiR’iiii iRbiiiiis (R’iii(R’iii(R’i ii(Rbiii(Rbiii(Rbiii(RRRR R!R—R˜RD(R txml((s-/usr/local/lib/python2.7/test/test_pyexpat.pyRn«s  (RRR R!R“Rn(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR‘˜s   t sf1296433TestcBseZd„ZRS(csbddd}dtfd„ƒY‰‡fd†}tjƒ}||_|jt|j|ƒdS(Ns1%sRitSpecificExceptioncBseZRS((RR(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR¿scs ˆ‚dS(N((R-(R(s-/usr/local/lib/python2.7/test/test_pyexpat.pythandlerÂs(t ExceptionRRR$RNRD(R R›RžR((Rs-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_parse_only_xml_data¸s   (RRR (((s-/usr/local/lib/python2.7/test/test_pyexpat.pyRœ·stChardataBufferTestcBsheZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z RS( s. test setting of chardata buffer size cCs|j|jdƒdƒdS(Nii(R tsmall_buffer_test(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_1025_bytesÏscCs|j|jdƒdƒdS(Nièi(R R¢(R ((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_1000_bytesÒscshtjƒ‰dˆ_‡fd†}|jt|tjdƒ|jt|dƒ|jt|dƒdS(Nics |ˆ_dS(N(t buffer_size(tsize(R(s-/usr/local/lib/python2.7/test/test_pyexpat.pytfØsiÿÿÿÿi(RRRqRNR`tsystmaxintRO(R R§((Rs-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_wrong_sizeÕs   cCs²ddd}ddd}tjƒ}|j|_d|_d|_d|_|j|ƒ|j|jdƒ|j|_|j|jdƒ|j|ƒ|j|jdƒdS(Ns-%sRisiii( RRtcounting_handlerR$R¥RqtnRDR (R txml1txml2R((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_unchanged_sizeßs        cCs[ddd}dd}ddd}tjƒ}|j|_d|_d|_|j|jdƒd |_|j|d ƒ|j|jdƒ|j|jdƒd |_|j |jƒ|j|jdƒx$t d ƒD]}|j|d ƒqÛW|j|jd ƒd|_|j |jƒ|j|jdƒ|j|dƒ|j|jd ƒdS( Ns-%sRitbis%stciii i i ( RRR«R$RqR¥R R¬RDR}trangeRj(R R­R®txml3Rti((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_disabling_bufferös.        cCsd|ddS(NsRs((R tbytes((s-/usr/local/lib/python2.7/test/test_pyexpat.pyt make_documentscCs|jd7_dS(Ni(R¬(R R-((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR«scCsUdd|}tjƒ}|j|_d|_d|_d|_|j|ƒ|jS(Ns1%sRiii(RRR«R$R¥RqR¬RD(R t buffer_lenR›R((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR¢s      cCs»ddd}ddd}tjƒ}|j|_d|_d|_|j|jdƒd|_|j|dƒ|jd9_|j|jd ƒ|j|dƒ|j|jdƒdS( Ns0%sRisaaa%siiiii( RRR«R$RqR¥R R¬RD(R R­R®R((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_change_size_1's     cCs»ddd}ddd}tjƒ}|j|_d|_d|_|j|jdƒd|_|j|dƒ|jd _|j|jd ƒ|j|dƒ|j|jd ƒdS( Ns1a%sRiÿsaaa%siiiiiii( RRR«R$RqR¥R R¬RD(R R­R®R((s-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_change_size_27s     ( RRt__doc__R£R¤RªR¯RµR·R«R¢R¹Rº(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR¡Ês      tMalformedInputTextcBseZd„Zd„ZRS(cCscd}tjƒ}y|j|tƒ|jƒWn,tjk r^}|jt|ƒdƒnXdS(Nt s unclosed token: line 2, column 0(RRRDtTrueR_t ExpatErrorR Ra(R R›RRb((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR„Hs cCscd}tjƒ}y|j|tƒ|jƒWn,tjk r^}|jt|ƒdƒnXdS(Ns s2XML declaration not well-formed: line 1, column 14(RRRDR¾R_R¿R Ra(R R›RRb((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR…Qs (RRR„R…(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyR¼Gs tForeignDTDTestscBs eZdZd„Zd„ZRS(sE Tests for the UseForeignDTD method of expat parser objects. csÁg‰‡fd†}tjƒ}|jtƒ|jtjƒ||_|jdƒ|jˆdgƒgˆ(tjƒ}|jƒ|jtjƒ||_|jdƒ|jˆdgƒdS(sÒ If UseForeignDTD is passed True and a document without an external entity reference is parsed, ExternalEntityRefHandler is first called with None for the public and system ids. csˆj||fƒdS(Ni(R(R;R0t system_idt public_id(thandler_call_args(s-/usr/local/lib/python2.7/test/test_pyexpat.pytresolve_entityessN(NN(NN( RRt UseForeignDTDR¾tSetParamEntityParsingtXML_PARAM_ENTITY_PARSING_ALWAYSR>RDR R](R RÄR((RÃs-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_use_foreign_dtd^s        cskg‰‡fd†}tjƒ}|jtƒ|jtjƒ||_|jdƒ|jˆdgƒdS(sÒ If UseForeignDTD is passed True and a document with an external entity reference is parsed, ExternalEntityRefHandler is called with the public and system ids from the document. csˆj||fƒdS(Ni(R(R;R0RÁRÂ(RÃ(s-/usr/local/lib/python2.7/test/test_pyexpat.pyRÄss@tbartbazN(RÉRÊ( RRRÅR¾RÆRÇR>RDR (R RÄR((RÃs-/usr/local/lib/python2.7/test/test_pyexpat.pyttest_ignore_use_foreign_dtdzs   (RRR»RÈRË(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyRÀZs c Cs,tttttttttt t t ƒ dS(N( RRRR\RfRoRŽR‘RœR¡R¼RÀ(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyt test_mainŽst__main__(RIR¨tunittestt xml.parsersRRnRttest.test_supportRRtTestCaseRR#RR\RfRoRŽR‘RœR¡R¼RÀRÌR(((s-/usr/local/lib/python2.7/test/test_pyexpat.pyts& .´#`}4