AlkantarClanX12
Current Path : /opt/alt/python37/lib64/python3.7/site-packages/lxml/__pycache__/ |
Current File : //opt/alt/python37/lib64/python3.7/site-packages/lxml/__pycache__/doctestcompare.cpython-37.pyc |
B �|/\�G � @ sp d Z ddlmZ ddlZddlZddlZyddlmZ W n e k rX ddl mZ Y nX ddddd d dgZyeZ W n ek r� eefZ Y nX ejd dkZe�d�Ze�d�Ze�d�ZejZd d� Zdd� Zejddd�Zdd� Ze�d�Ze�d�ZG dd� de�Z G dd � d e �Z!d#dd �Z"d$dd�Z#G dd� de$�Z%dd� Z&d d!iZ'e(d"k�rlddlZe�)� 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 ``<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`` � )�etreeN)�escape� PARSE_HTML� PARSE_XML�NOPARSE_MARKUP�LXMLOutputChecker�LHTMLOutputChecker�install�temp_install� c C s | d krd S | � � S d S )N)�strip)�v� r �F/opt/alt/python37/lib64/python3.7/site-packages/lxml/doctestcompare.pyr ? s r c C s t �d| �S )N� )�_norm_whitespace_re�sub)r r r r �norm_whitespaceE s r FT)ZrecoverZremove_blank_textc C s t �| t�S )N)r Z fromstring�_html_parser)�htmlr r r �html_fromstringJ s r z^<[^>]+ (at|object) z[ \t\n][ \t\n]+c @ s� e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dd� Zd'dd�Zd(dd�Z d)dd�Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd*d$d%�Zd&S )+r ) �paramZimgZarea�brZbasefont�input�base�meta�link�colc C s t jS )N)r �XML)�selfr r r �get_default_parserW s z$LXMLOutputChecker.get_default_parserc C s� t | dd �}|d k r | j}|} ntj}| �|||�}|sF|| |||�S y||�}W n tjk rh dS X y||�}W n tjk r� dS X | �||�S )N�_temp_override_selfF)�getattr�_temp_call_super_check_output� OutputChecker�check_output� get_parserr �XMLSyntaxError�compare_docs) r �want�got�optionflagsZalt_selfZsuper_method�parser�want_doc�got_docr r r r% Z s$ zLXMLOutputChecker.check_outputc C st d }t |@ rd S t|@ rt}nRt|@ r.tj}nB|�� �� �d�rT|�� �d�rTt}n| � |�rp| � |�rp| � � }|S )Nz<html)r r r r r r r �lower� startswith�_looks_like_markupr )r r) r* r+ r, r r r r&