Files
wg-backend-django/acer-env/lib/python3.10/site-packages/lxml/__pycache__/doctestcompare.cpython-310.pyc

169 lines
14 KiB
Plaintext
Raw Normal View History

2022-11-30 15:58:16 +07:00
o
<00>Ԅc<D484>G<00>@sddZddlmZddlZddlZddlZzddlmZWne y+ddl
mZYnwgd<05>Z ze Z Wn eyAeefZ YnwejddkZe<05>d<07>Ze<05>d<08>Ze<05>d <09>ZejZd
d <0B>Zd d <0A>Zejddd<10>Zdd<12>Ze<04>d<13>Ze<04>d<14>ZGdd<16>de<17>Z Gdd<18>de <20>Z!d$dd<1A>Z"d%dd<1C>Z#Gdd<1E>de$<24>Z%dd <20>Z&d!d"iZ'e(d#kr<>ddlZe<05>)<29>dSdS)&a<>
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 ``<html``). You can also use the
``PARSE_HTML`` and ``PARSE_XML`` flags to force parsing.
Some rough wildcard-like things are allowed. Whitespace is generally
ignored (except in attributes). In text (attributes and text in the
body) you can use ``...`` as a wildcard. In an example it also
matches any trailing tags in the element, though it does not match
leading tags. You may create a tag ``<any>`` 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``
<EFBFBD>)<01>etreeN)<01>escape)<07>
PARSE_HTML<EFBFBD> PARSE_XML<4D>NOPARSE_MARKUP<55>LXMLOutputChecker<65>LHTMLOutputChecker<65>install<6C> temp_install<6C>rrrcCs|durdS|<00><00>S<00>N)<01>strip<69><01>v<>r<00>f/home/infidel/Sync/Project/ocp-wg-backend/acer-env/lib/python3.10/site-packages/lxml/doctestcompare.pyr ?sr cCs t<00>d|<00>S)N<> )<02>_norm_whitespace_re<72>subrrrr<00>norm_whitespaceE<00> rFT)<02>recover<65>remove_blank_textcCs t<00>|t<02>Sr )r<00>
fromstring<EFBFBD> _html_parser<65><01>htmlrrr<00>html_fromstringJrrz^<[^>]+ (at|object) z[ \t\n][ \t\n]+c@s<>eZdZdZdd<03>Zdd<05>Zdd<07>Zdd <09>Zd
d <0B>Zd d <0A>Z dd<0F>Z
dd<11>Z d'dd<14>Z d(dd<17>Z d'dd<19>Zdd<1B>Zdd<1D>Zdd<1F>Zd d!<21>Zd"d#<23>Zd'd$d%<25>Zd&S))r)
<EFBFBD>param<61>img<6D>area<65>br<62>basefont<6E>input<75>base<73>meta<74>link<6E>colcCstjSr )r<00>XML<4D><01>selfrrr<00>get_default_parserWsz$LXMLOutputChecker.get_default_parserc Cs<>t|dd<00>}|dur|j}|}ntj}|<00>|||<03>}|s#|||||<03>Sz||<01>}Wn tjy4YdSwz||<02>}Wn tjyFYdSw|<00>||<08>S)N<>_temp_override_selfF)<08>getattr<74>_temp_call_super_check_output<75> OutputChecker<65> check_output<75>
get_parserr<00>XMLSyntaxError<6F> compare_docs) r*<00>want<6E>got<6F> optionflags<67>alt_self<6C> super_method<6F>parser<65>want_doc<6F>got_docrrrr0Zs* <04> <02> <02> zLXMLOutputChecker.check_outputcCszd}t|@rdSt|@rt}|St|@rtj}|S|<01><06><00><07><00>d<01>r-|<02><06><00>d<01>r-t}|S|<00> |<01>r;|<00> |<02>r;|<00>
<EFBFBD>}|S)Nz<html) rrrrrr(r <00>lower<65>
startswith<EFBFBD>_looks_like_markupr+)r*r4r5r6r9rrrr1os& <08><12> <02>
<EFBFBD><02>zLXMLOutputChecker.get_parsercCs|<01><00>}|<01>d<01>ot<02>|<01> S)N<><)r r=<00>_repr_re<72>search)r*<00>srrrr>s

<02>z$LXMLOutputChecker._looks_like_markupc
Cs|<00>|j|j<01>s
dS|<00>|j|jd<02>sdS|<00>|j|jd<02>s dSd|jvrNt|j<05><07><00>}t|j<05><07><00>}||kr9dS|D]}|<00>|j||j|d<01>sMdSq;|jdksWt|<01>r<>t |<01>}t |<02>}|sc|r<>|rg|sidS|<06>
d<05>}|<07>
d<05>} |<00> || <09>s{dS|s<>|jdkr<> dS|sc|scdS)NFT<46>anyz...r) <0C> tag_compare<72>tag<61> text_compare<72>text<78>tail<69>attrib<69>sorted<65>keys<79>len<65>list<73>popr3)
r*r4r5<00> want_keys<79>got_keys<79>key<65> want_children<65> got_children<65>
want_first<EFBFBD> got_firstrrrr3<00>s<
<02>

 <08> zLXMLOutputChecker.compare_docscCsZ|pd}|pd}|rt|<01><01><01>}t|<02><01><01>}dt<02>|<01>}|<01>dd<04>}t<02>||<02>r+dSdS)N<>z^%s$z\.\.\.z.*TF)rr <00>rer<00>replacerA)r*r4r5r rrrrF<00>s    zLXMLOutputChecker.text_comparecCsf|dkrdSt|t<01>rt|t<01>s||kS|pd}|pd}|<01>d<04>r/|<01>d<05>d|<02>d<05>dkS||kS)NrCTrVz{...}<7D>}<7D><><EFBFBD><EFBFBD><EFBFBD>)<04>
isinstance<EFBFBD> _basestringr=<00>split)r*r4r5rrrrD<00>s
<02>
zLXMLOutputChecker.tag_comparec Cs|j}|<00>|||<03>}g}|durLz||<04>}Wntjy-t<04><05>d}|<06>d|<00>Ynwz||<02>} WntjyKt<04><05>d}|<06>d|<00>Ynw|dusR|rht<07>||||<03>}
|rf|<06>|
<EFBFBD>d<04> |<06>S|
S|t
u} d|<00> || d<06>d|<00> | | d<06>d|<00> || | d<06>g} d<04> | <0C>S) N<>zIn example: %szIn actual output: %s<>
z Expected:<3A>zGot:zDiff:) r4r1rr2<00>sys<79>exc_info<66>appendr/<00>output_difference<63>joinr<00>
format_doc<EFBFBD> collect_diff) r*<00>exampler5r6r4r9<00>errorsr:<00>er;<00>valuer<00>
diff_partsrrrrd<00>sB  <02>  <02> <04>

  <04>
z#LXMLOutputChecker.output_differenceTcCs.|sdS|j|jvr dS|jst|<01>rdSdS)NFT)rE<00>
empty_tagsrGrL)r*<00>elrrrr<00>html_empty_tag<61>s z LXMLOutputChecker.html_empty_tagrVc Cs<>g}t|<01>sN|<05>d|<00>|<05>|<04>|<05>|<00>|<01><01>|<00>||<02>s6t|j<05>r.|<05>|<00>|j<05><01>|<05>|<00>|<01><01>t|j<08>rD|<05>|<00>|j<08><01>|<05>d<02>d<03> |<05>S|<05>d|<00>|<05>|<04>|<05>|<00>|<01><01>|<00>||<02>s<>|<05>d<02>t|j<05>r<>|<05>d|<00>|<05>|<00>|j<05><01>|<05>d<02>|D]}|<05>|<00>
|||d<00><03>q<>|<05>d|<00>|<05>|<00>|<01><01>|<05>d<02>t|j<08>r<>|<05>d|<00>|<05>|<00>|j<08><01>|<05>d<02>d<03> |<05>S)Nrr_rVr`) rLrc<00>
format_tagror rG<00> format_text<78>format_end_tagrHrerf)r*<00>docr<00>indent<6E>prefix<69>partsrnrrrrf<00>s@
 




 






zLXMLOutputChecker.format_doccCs"|durdS|r |<01><00>}t|d<02>S)NrVr^)r <00> html_escape)r*rGr rrrrq s

zLXMLOutputChecker.format_textc Cshg}t|tj<02>r
dSt|j<04><05><00>D]\}}|<02>d||<00>|d<03>f<00>q|s*d|jSd|jd<06> |<02>fS)Nz<!--<2D>%s="%s"F<><%s><3E><%s %s>r)
r[r<00> CommentBaserJrI<00>itemsrcrqrEre)r*rn<00>attrs<72>namerkrrrrps 
zLXMLOutputChecker.format_tagcCst|tj<02>rdSd|jS)Nz--><3E></%s>)r[rr{rE)r*rnrrrrrs 
z LXMLOutputChecker.format_end_tagc Csg}t|<01>sIt|<02>sI|<05>d|<00>|<05>|<00>||<02><02>|<00>||<03>s4|<05>|<00>|j|j<05><02>|<05>|<00>||<02><02>|<05>|<00>|j|j<07><02>|<05>d<02>d<03>|<05>S|<05>d|<00>|<05>|<00>||<02><02>|<05>d<02>t |j<05>sht |j<05>r|<05>d|<00>|<05>|<00>|j|j<05><02>|<05>d<02>t
|<01>}t
|<02>}|s<>|r<>|s<>|<05>|<00> |<07> d<04>||dd<06><04>q<>|s<>|<05>|<00> |<06> d<04>||dd<07><04>q<>|<05>|<00> |<06> d<04>|<07> d<04>||d<00><04>|s<>|s<>|<05>d|<00>|<05>|<00>||<02><02>|<05>d<02>t |j<07>s<>t |j<07>r<>|<05>d|<00>|<05>|<00>|j|j<07><02>|<05>d<02>d<03>|<05>S)Nrr_rVrr`<00>+<2B>-)rLrc<00>collect_diff_tagro<00>collect_diff_textrG<00>collect_diff_end_tagrHrer rMrfrNrg)r*r4r5rrtrvrRrSrrrrg!sL 



  <06><08> 


zLXMLOutputChecker.collect_diffc Cs(|<00>|j|j<01>sd|j|jf}n|j}g}|jdkpd|jv}t|j<02><04><00>D]8\}}||jvr@|s@|<04>d||<00>|d<04>f<00>q'||jvrP|<00>|j||d<04>}n|<00>|d<04>}|<04>d||f<00>q'|s<>t|j<02><04><00>D]\}}||jvrsqi|<04>d||<00>|d<04>f<00>qi|r<>d|d<08>|<04>f}|Sd |}|S)
N<EFBFBD> %s (got: %s)rCz+%s="%s"Frxz-%s="%s"rzrry) rDrErIrJr|rcrqr<>re) r*r4r5rEr}rCr~rkrGrrrr<>Gs,
 
<08>z"LXMLOutputChecker.collect_diff_tagcCs2|j|jkrd|j|jf}d|S|j}d|S)Nr<4E>r)rE)r*r4r5rErrrr<>bs
<06>z&LXMLOutputChecker.collect_diff_end_tagcCs:|<00>|||<03>r|s dS|<00>||<03>Sd||f}|<00>||<03>S)NrVr<>)rFrq)r*r4r5r rGrrrr<>is    z#LXMLOutputChecker.collect_diff_textN)T)rV)<15>__name__<5F>
__module__<EFBFBD> __qualname__rmr+r0r1r>r3rFrDrdrorfrqrprrrgr<>r<>r<>rrrrrQs& 
# &rc@seZdZdd<02>ZdS)rcCstSr )rr)rrrr+rsz%LHTMLOutputChecker.get_default_parserN)r<>r<>r<>r+rrrrrqs rcCs|rtt_dStt_dS)z<>
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)r<00>doctestr/rrrrrr us

r c Csz|rt}nt}t<02>}|jd}|<02>}|j}||_tr%|jdj}|jj}n
|jdj}|jj}t t
_ t ||||||<01>dS)z<>
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*<00>checkN) rr<00>_find_doctest_frame<6D>f_locals<6C>_checker<65> _IS_PYTHON_3<5F>__func__r0<00>im_funcrr<><00>_RestoreChecker) r<00>
del_module<EFBFBD>Checker<65>frame<6D>dt_self<6C>checker<65> old_checker<65>
check_func<EFBFBD>checker_check_funcrrrr
<00>s$


 <08>r
c@sLeZdZdd<02>Zdd<04>Zdd<06>Zdd<08>Zd d
<EFBFBD>Zd d <0C>Zd d<0E>Z dd<10>Z
dS)r<>cCsD||_||_|j|j_||j_||_||_||_|<00><08>|<00> <09>dSr )
r<EFBFBD>r<><00>
call_superr.r,r<><00>
clone_funcr<EFBFBD><00> install_clone<6E>install_dt_self)r*r<>r<><00> new_checkerr<72>r<>r<>rrr<00>__init__<5F>s
 z_RestoreChecker.__init__cCsLtr|jj|_|jj|_|jj|j_dS|jj|_|jj|_|jj|j_dSr )r<>r<><00>__code__<5F> func_code<64> __globals__<5F> func_globalsr<73>r)rrrr<><00>s



z_RestoreChecker.install_clonecCs tr |j|j_dS|j|j_dSr )r<>r<>r<>r<>r)rrr<00>uninstall_clone<6E>sz_RestoreChecker.uninstall_clonecCs|jj|_||j_dSr )r<><00>_DocTestRunner__record_outcome<6D> prev_funcr)rrrr<><00>s
 z_RestoreChecker.install_dt_selfcCs|j|j_dSr )r<>r<>r<>r)rrr<00>uninstall_dt_self<6C>sz!_RestoreChecker.uninstall_dt_selfcCsT|jr&ddl}|j|j=d|jvr(|j<00>dd<03>\}}|j|}t||<03>dSdSdS)Nr<00>.r^)r<>ra<00>modules<65>rsplit<69>delattr)r*ra<00>package<67>module<6C> package_modrrr<00>uninstall_module<6C>s


<04>z _RestoreChecker.uninstall_modulecOs8|<00><00>|<00><01>|j`|j`|j|i|<02><01>}|<00><06>|Sr )r<>r<>r<>r,r.r<>r<>)r*<00>args<67>kw<6B>resultrrr<00>__call__<5F>sz_RestoreChecker.__call__cOs.|<00><00>z |j|i|<02><01>W|<00><02>S|<00><02>wr )r<>r<>r<>)r*r<>r<>rrrr<><00>sz_RestoreChecker.call_superN) r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>r<>rrrrr<><00>s   r<>cCs:ddl}|<00>d<02>}|r|j}d|vr|S|j}|s td<04><01>)Nrr^<00>BOOMzBCould not find doctest (only use this function *inside* a doctest))ra<00> _getframer<65><00>f_back<63> LookupError)rar<><00>lrrrr<><00>s
<04><04>r<EFBFBD><00>basicai
>>> temp_install()
>>> print """<xml a="1" b="2">stuff</xml>"""
<xml b="2" a="1">...</xml>
>>> print """<xml xmlns="http://example.com"><tag attr="bar" /></xml>"""
<xml xmlns="...">
<tag attr="..." />
</xml>
>>> print """<xml>blahblahblah<foo /></xml>""" # doctest: +NOPARSE_MARKUP, +ELLIPSIS
<xml>...foo /></xml>
<20>__main__)F)FN)*<2A>__doc__<5F>lxmlrrarWr<>rrrw<00> ImportError<6F>cgi<67>__all__<5F>
basestringr\<00> NameError<6F>str<74>bytes<65> version_infor<6F><00>register_optionflagrrrr/r r<00>
HTMLParserrr<00>compiler@rrrr r
<00>objectr<74>r<><00>__test__r<5F><00>testmodrrrr<00><module>sR % <02>  <02>




"

'6 <04>  <04>