ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ U*Wc@sdZddlmZddlZddlZddlZyddlmZWn!e k rqddl mZnXddddd d d gZ y e Z Wnek reefZ nXejd d kZejdZejdZejdZejZdZdZejdedeZdZejdZ ejdZ!defdYZ"d e"fdYZ#edZ$ee%dZ&de'fdYZ(dZ)idd6Z*e+dkrddlZej,ndS(s lxml-based doctest output comparison. Note: normally, you should just import the `lxml.usedoctest` and `lxml.html.usedoctest` modules from within a doctest, instead of this one:: >>> import lxml.usedoctest # for XML output >>> import lxml.html.usedoctest # for HTML output To use this module directly, you must call ``lxmldoctest.install()``, which will cause doctest to use this in all subsequent calls. This changes the way output is checked and comparisons are made for XML or HTML-like content. XML or HTML content is noticed because the example starts with ``<`` (it's HTML if it starts with ```` or include an ``any`` attribute in the tag. An ``any`` tag matches any tag, while the attribute matches any and all attributes. When a match fails, the reformatted example and gotten text is displayed (indented), and a rough diff-like output is given. Anything marked with ``+`` is in the output but wasn't supposed to be, and similarly ``-`` means its in the example but wasn't in the output. You can disable parsing on one line with ``# doctest:+NOPARSE_MARKUP`` i(tetreeN(tescapet PARSE_HTMLt PARSE_XMLtNOPARSE_MARKUPtLXMLOutputCheckertLHTMLOutputCheckertinstallt temp_installiicCs|dkrdS|jSdS(N(tNonetstrip(tv((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyR ?s cCstjd|S(Nt (t_norm_whitespace_retsub(R ((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pytnorm_whitespaceEstrecovertremove_blank_textcCstj|tS(N(Rt fromstringt _html_parser(thtml((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pythtml_fromstringJss^<[^>]+ (at|object) s[ \t\n][ \t\n]+c BseZdZd Zd Zd Zd ZdZdZdZ dZ e dZ ddZ e dZdZdZdZdZdZe dZRS(tparamtimgtareatbrtbasefonttinputtbasetmetatlinktcolcCstjS(N(RtXML(tself((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pytget_default_parserWsc Cst|dd}|dk r0|j}|}n tj}|j|||}|sg|||||Sy||}Wntjk rtSXy||}Wntjk rtSX|j ||S(Nt_temp_override_self( tgetattrR t_temp_call_super_check_outputt OutputCheckert check_outputt get_parserRtXMLSyntaxErrortFalset compare_docs( R!twanttgott optionflagstalt_selft super_methodtparsertwant_doctgot_doc((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyR'Zs$    cCsd}t|@rdSt|@r't}n|t|@r=tj}nf|jjj drv|jj drvt}n-|j |r|j |r|j }n|S(Nss  cCs|dkrtSt|t s0t|t r:||kS|pCd}|pOd}|jdr|jdd|jddkS||kSdS(NR;ROs{...}t}i(R@t isinstancet _basestringR5tsplit(R!R,R-((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyR<s    $c Cs|j}|j|||}g}|dk ry||}Wn5tjk rwtjd}|jd|nXy||} Wqtjk rtjd}|jd|qXn|dks|rtj ||||} |r |j| dj |S| Sn|t k} g} | jd| j|j || d| jd| j|j | | d| jd| j|j || | ddj | S( NisIn example: %ssIn actual output: %ss s Expected:isGot:sDiff:(R,R(R RR)tsystexc_infotappendR&toutput_differencetjoinRt format_doct collect_diff( R!texampleR-R.R,R1terrorsR2teR3tvalueRt diff_parts((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRYs<        cCs=|s tS|j|jkr tS|js5t|r9tStS(N(R*R=t empty_tagsR?RER@(R!telR((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pythtml_empty_tagsROcCs;g}t|s|jd||j||j|j||j||st|jr|j|j|jn|j|j|nt|jr|j|j|jn|jddj |S|jd||j||j|j||j||s|jdt|jr}|jd||j|j|j|jdnx.|D]&}|j|j |||dqW|jd||j|j||jdnt|jr.|jd||j|j|j|jdndj |S(NR s ROi( RERXt format_tagRdR R?t format_texttformat_end_tagRARZR[(R!tdocRtindenttprefixtpartsRc((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyR[s@       $cCs2|dkrdS|r%|j}nt|dS(NROi(R R t html_escape(R!R?R ((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRf s  cCsg}t|tjrdSxFt|jjD]/\}}|jd||j|tfq2W|svd|j Sd|j dj |fS(Nss(RSRRmR=(R!Rc((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRgscCsg}t| rt| r|jd||j|j|||j||s|j|j|j|j|j|j||n|j|j|j|j|jddj|S|jd||j|j|||jdt |js%t |jre|jd||j|j|j|j|jdnt |}t |}x|s|r4|s|j|j |j d||ddqn|s|j|j |j d||ddqn|j|j |j d|j d||dqW|jd||j|j|||jdt |jst |jr|jd||j|j|j|j|jdndj|S(NR s ROiit+t-(RERXtcollect_diff_tagRdtcollect_diff_textR?tcollect_diff_end_tagRARZR RFR[RGR\(R!R,R-RRiRkRKRL((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyR\"sH     ,, - c Cs|j|j|js1d|j|jf}n |j}g}|jdkp[d|jk}xt|jjD]\}}||jkr| r|jd||j|tfqt||jkr|j|j||t}n|j|t}|jd||fqtW|s~x^t|jjD]D\}}||jkrTq3n|jd||j|tfq3Wn|rd|dj |f}n d|}|S( Ns %s (got: %s)R;s+%s="%s"s%s="%s"s-%s="%s"s<%s %s>R s<%s>( R<R=RBRCRnRXRfR*RtRZ( R!R,R-R=RoR;RpR`R?((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRsHs* "&"* cCs<|j|jkr+d|j|jf}n |j}d|S(Ns %s (got: %s)s(R=(R!R,R-R=((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRucs cCsO|j|||r/|sdS|j||Sd||f}|j||S(NROs %s (got: %s)(R>Rf(R!R,R-R R?((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRtjs ( RRRRRRRRRR(t__name__t __module__RbR"R'R(R6R+R>R<RYR@RdR[RfReRgR\RsRuRt(((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRQs&       ! #   &  cBseZdZRS(cCstS(N(R(R!((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyR"ss(RvRwR"(((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRrscCs|rtt_n tt_dS(s Install doctestcompare for all future doctests. If html is true, then by default the HTML parser will be used; otherwise the XML parser is used. N(RtdoctestR&R(R((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRvs c Cs|rt}nt}t}|jd}|}|j}||_trk|jdj}|jj}n|jdj}|jj}t t _ t ||||||dS(s Use this *inside* a doctest to enable this checker for this doctest only. If html is true, then by default the HTML parser will be used; otherwise the XML parser is used. R!tcheckN( RRt_find_doctest_frametf_localst_checkert _IS_PYTHON_3t__func__R'tim_funcRRxt_RestoreChecker( Rt del_moduletCheckertframetdt_selftcheckert old_checkert check_functchecker_check_func((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRs"         RcBsPeZdZdZdZdZdZdZdZdZ RS(cCs`||_||_|j|j_||j_||_||_||_|j|j dS(N( RRt call_superR%R#Rt clone_funcRt install_clonetinstall_dt_self(R!RRt new_checkerRRR((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyt__init__s       cCsmtr9|jj|_|jj|_|jj|j_n0|jj|_|jj|_|jj|j_dS(N(R}Rt__code__t func_codet __globals__t func_globalsR(R!((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRscCs+tr|j|j_n|j|j_dS(N(R}RRR(R!((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pytuninstall_clonescCs|jj|_||j_dS(N(Rt_DocTestRunner__record_outcomet prev_func(R!((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRscCs|j|j_dS(N(RRR(R!((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pytuninstall_dt_selfscCsp|jrlddl}|j|j=d|jkrl|jjdd\}}|j|}t||qlndS(Nit.i(RRVtmodulestrsplittdelattr(R!RVtpackagetmodulet package_mod((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pytuninstall_modules    cOsF|j|j|j`|j`|j||}|j|S(N(RRRR#R%RR(R!targstkwtresult((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyt__call__s     cOs0|jz|j||SWd|jXdS(N(RRR(R!RR((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRs ( RvRwRRRRRRRR(((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRs     cCsZddl}|jd}x,|rI|j}d|kr=|S|j}qWtddS(NiitBOOMsBCould not find doctest (only use this function *inside* a doctest)(RVt _getframeR{tf_backt LookupError(RVRtl((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyRzs     si >>> temp_install() >>> print """stuff""" ... >>> print """""" >>> print """blahblahblah""" # doctest: +NOPARSE_MARKUP, +ELLIPSIS ...foo /> tbasict__main__(-t__doc__tlxmlRRVRPRxRRRlt ImportErrortcgit__all__t basestringRTt NameErrortstrtbytest version_infoR}tregister_optionflagRRRR&R Rt HTMLParserR*R@RRtcompileR8R RRRR RtobjectRRzt__test__Rvttestmod(((s9/usr/lib64/python2.7/site-packages/lxml/doctestcompare.pyt$sJ           " '6