mW < d Z ddlmZ ddlZddlZddlZ ddlmZ n# e $ r ddl mZ Y nw xY wg dZ eZ n# e$ r eefZ Y nw xY wej d dk Z ej d Z ej d Z ej d Zej Zd Zd Z ej dd Zd Z ej d Z ej d Z G d de Z G d de Z!ddZ"ddZ# G d de$ Z%d Z&ddiZ'e(dk rddlZ ej) dS dS ) 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 ```` 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`` )etreeN)escape) PARSE_HTML PARSE_XMLNOPARSE_MARKUPLXMLOutputCheckerLHTMLOutputCheckerinstalltemp_install r r r c 2 | d S | S N)stripvs g/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib64/python3.11/site-packages/lxml/doctestcompare.pyr r ? s ytwwyy c 8 t d| S )N )_norm_whitespace_resubr s r norm_whitespacer E s ""3***r FT)recoverremove_blank_textc 6 t j | t S r )r fromstring_html_parserhtmls r html_fromstringr J s D,///r z^<[^>]+ (at|object) z[ \t\n][ \t\n]+c e Zd ZdZd Zd Zd Zd Zd Zd Z d Z d ZddZdd Z ddZd Zd Zd Zd Zd ZddZdS )r ) paramimgareabrbasefontinputbasemetalinkcolc t j S r )r XMLselfs r get_default_parserz$LXMLOutputChecker.get_default_parserW s yr c Z t | dd }| | j }|} nt j }| ||| }|s || ||| S || }n# t j $ r Y dS w xY w || }n# t j $ r Y dS w xY w| || S )N_temp_override_selfF)getattr_temp_call_super_check_output OutputCheckercheck_output get_parserr XMLSyntaxErrorcompare_docs) r/ wantgotoptionflagsalt_selfsuper_methodparserwant_docgot_docs r r6 zLXMLOutputChecker.check_outputZ s 4!6===LDD(5LsK88 .<dC. . . vd||HH# 55 fSkkGG# 55 7333s$ A A10A15B BBc d }t |z rd S t |z rt }nt |z r t j }n| d r/| d rt }n>| | r)| | r| }|S )Nz