Your IP : 18.226.166.207


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/doctest.cpython-312.opt-2.pyc

�

�Q�f����N�	dZgd�ZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZddlmZedd�ZiZd�Zed	�Zed
�Zed�Zed�Zed
�Zed�ZeezezezezezZed�Zed�Zed�Zed�Zed�ZeezezezezZ dZ!dZ"d�Z#dVd�Z$d�Z%d�Z&dWd�Z'd�Z(Gd�de
�Z)d�Z*d�Z+d �Z,Gd!�d"ejZ�Z.d#�Z/Gd$�d%�Z0Gd&�d'�Z1Gd(�d)�Z2Gd*�d+�Z3Gd,�d-�Z4Gd.�d/�Z5Gd0�d1e6�Z7Gd2�d3e6�Z8Gd4�d5e4�Z9da:			dXd8�Z;d6ddddd6ddd7e2�dfd9�Z<		dYd:�Z=da>d;�Z?Gd<�d=ej��ZAGd>�d?eA�ZBGd@�dAej��ZDdZdB�ZEGdC�dDeA�ZFd6dde2�dfdE�ZGdF�ZHdG�ZIdH�ZJd[dI�ZKd[dJ�ZLd\dK�ZMGdL�dM�ZNeNdNdOdPdQdRdS�ZOdT�ZPeQdUk(re	j�eP��yy)]zreStructuredText en)!�register_optionflag�DONT_ACCEPT_TRUE_FOR_1�DONT_ACCEPT_BLANKLINE�NORMALIZE_WHITESPACE�ELLIPSIS�SKIP�IGNORE_EXCEPTION_DETAIL�COMPARISON_FLAGS�REPORT_UDIFF�REPORT_CDIFF�REPORT_NDIFF�REPORT_ONLY_FIRST_FAILURE�REPORTING_FLAGS�	FAIL_FAST�Example�DocTest�
DocTestParser�
DocTestFinder�
DocTestRunner�
OutputChecker�DocTestFailure�UnexpectedException�DebugRunner�testmod�testfile�run_docstring_examples�DocTestSuite�DocFileSuite�set_unittest_reportflags�script_from_examples�
testsource�	debug_src�debug�N)�StringIO�IncrementalNewlineDecoder)�
namedtuple�TestResultszfailed attemptedc�N�tj|dtt�z�S)N�)�OPTIONFLAGS_BY_NAME�
setdefault�len)�names �./opt/alt/python312/lib64/python3.12/doctest.pyrr�s ���)�)�$��S�9L�5M�0M�N�N�rrrrrrr
rrr
rz<BLANKLINE>z...c��	d}tjD]6}|j|d�}|tt|�us�(||jz}�8|S�Nr#)�
__future__�all_feature_names�get�getattr�
compiler_flag)�globs�flags�fname�features    r.�_extract_future_flagsr;�sT���
�E��-�-���)�)�E�4�(���g�j�%�0�0��W�*�*�*�E�.��Lr/c��	tj|�r|St|t�rt	|t�t
�dg�S|�(		tjtj|�Std��#t$r6tjtj|�jdcYSwxYw#t$rYywxYw)N�*�__name__z"Expected a module, string, or None)�inspect�ismodule�
isinstance�str�
__import__�globals�locals�sys�modules�_getframemodulename�AttributeError�	_getframe�	f_globals�KeyError�	TypeError)�module�depths  r.�_normalize_modulerP�s����������
�	�F�C�	 ��&�'�)�V�X��u�=�=�	��	�
O��{�{�3�#:�#:�5�#A�B�B��<�=�=��"�
O��{�{�3�=�=��#7�#A�#A�*�#M�N�N�
O���	��	�s*�%A=�=<B<�9B?�;B<�<B?�?	C�
Cc�:�tdd�j|d�S�NT)r%�decode)�datas r.�_newline_convertrU�s��$�T�4�0�7�7��d�C�Cr/c��|ryt|d�}t||�}t|dd�x}�	|jj}t
|d�r/|j|�}|j|�}t|�|fSt||��5}|j�|fcddd�S#t
$rY�owxYw#1swYyxYw)N��
__loader__�get_data)�encoding)rP�_module_relative_pathr5�__spec__�loaderrI�hasattrrYrSrU�open�read)�filename�package�module_relativerZr]�
file_contents�fs       r.�_load_testfilerf�s����#�G�Q�/��(��(�;���g�|�T�:�:�F�C�
� �)�)�0�0���6�:�&�"�O�O�H�5�M�)�0�0��:�M�$�M�2�H�<�<�	
�h��	*�a��v�v�x��!�"�"��"�
��
��
+�	*�s�B%�	B4�%	B1�0B1�4B=c�8�	tjd|dz|�S)Nz
(?m)^(?!$)� )�re�sub)�s�indents  r.�_indentrm�s ���
�6�6�,��s�
�A�.�.r/c�v�	t�}|\}}}tj||||��|j�S)N)�file)r$�	traceback�print_exception�getvalue)�exc_info�excout�exc_type�exc_val�exc_tbs     r.�_exception_tracebackrx�s=���
�Z�F� (��H�g�v�
���h���f�E��?�?��r/c��eZdZd�Zdd�Zy)�	_SpoofOutc�`�tj|�}|r|jd�s|dz
}|S�N�
)r$rr�endswith)�self�results  r.rrz_SpoofOut.getvalues0���"�"�4�(���&�/�/�$�/��d�N�F��
r/Nc�P�|j|�tj|�y�N)�seekr$�truncate)r�sizes  r.r�z_SpoofOut.truncates���	�	�$�����$�r/r�)r>�
__module__�__qualname__rrr��r/r.rzrzs��� r/rzc�t�	t|vr||k(S|jt�}dt|�}}|d}|r!|j|�rt|�}|d=ny|d}|r$|j	|�r|t|�z}|d=ny||kDry|D]*}|j|||�}|dkry|t|�z
}�,y)Nr#F���T)�ELLIPSIS_MARKER�splitr,�
startswithr~�find)�want�got�ws�startpos�endpos�ws      r.�_ellipsis_matchr�s����
�d�"��s�{��
���O�	$�B��#�c�(�f�H�
�1��A���>�>�!���1�v�H��1���
�2��A���<�<��?��c�!�f��F��2����&���
���8�8�A�x��0���a�<���C��F����r/c�4�	|j�}|rd|zSy)Nz# �#)�rstrip)�lines r.�
_comment_liner�Fs ��/��;�;�=�D���D�y��r/c���dt|�}}|jd�}|dk\r|}|jdd|�}|dk\r|}|jdd|�}|dk\r|dz}|||S)Nr#r}�:�.r))r,r��rfind)�msg�start�end�is    r.�_strip_exception_detailsr�Nsv���C��H�3�E������A��A�v�������a���A��A�v����	�	�#�q�#��A��A�v��!����u�c�?�r/c�(�eZdZ	d�Zdd�Zd�Zd�Zy)�_OutputRedirectingPdbc�r�||_d|_tjj	||d��d|_y)NFT)�stdout�nosigintr))�_OutputRedirectingPdb__out�$_OutputRedirectingPdb__debugger_used�pdb�Pdb�__init__�use_rawinput)r�outs  r.r�z_OutputRedirectingPdb.__init__ns2����
�$���������c�D��9���r/Nc��d|_|�tj�j}tj
j
||�yrR)r�rFrJ�f_backr�r��	set_trace)r�frames  r.r�z_OutputRedirectingPdb.set_tracevs4��#����=��M�M�O�*�*�E������$��&r/c�\�|jr tjj|�yyr�)r�r�r��set_continue�rs r.r�z"_OutputRedirectingPdb.set_continue|s$������G�G� � ��&� r/c���tj}|jt_	tjj
|g|���|t_S#|t_wxYwr�)rFr�r�r�r��trace_dispatch)r�args�save_stdouts   r.r�z$_OutputRedirectingPdb.trace_dispatch�sA���j�j���Z�Z��
�	%��7�7�)�)�$�6��6�$�C�J���C�J�s�A�
Ar�)r>r�r�r�r�r�r�r�r/r.r�r�hs���
�'�'�%r/r�c��tj|�std|z��|jd�rt	d��tjj|jd��}t|d�r-t
jj|j�d}n�|jdk(rwttj�dkDrJtjddk7r4t
jjtjd�d}n�t
j}nxt|d�rT|j D]E}t
jj||�}t
jj#|�s�C|cSt	d	|jz��t
jj||�S)
NzExpected a module: %r�/z1Module-relative files may not have absolute paths�__file__r#�__main__��__path__zBCan't resolve paths relative to the module %r (it has no __file__))r?r@rMr��
ValueError�os�path�joinr�r^r�r>r,rF�argv�curdirr��exists)rN�	test_path�basedir�	directory�fullpaths     r.r[r[�sI�����F�#��/�&�8�9�9����C� ��L�M�M������y���s�3�5�I��v�z�"��'�'�-�-����0��3��	���J�	&��s�x�x�=��?�s�x�x��{�b�0��g�g�m�m�C�H�H�Q�K�0��3�G��i�i�G��6�:�&�#�_�_�	��7�7�<�<�	�9�=���7�7�>�>�(�+�#�O�-��3�!�?�?�+�,�	,�
�7�7�<�<���+�+r/c�&�eZdZ			dd�Zd�Zd�Zy)rNc���|jd�s|dz
}|r|jd�s|dz
}|�|jd�s|dz
}||_||_||_||_|�i}||_||_yr|)r~�sourcer��linenorl�options�exc_msg)rr�r�r�r�rlr�s       r.r�zExample.__init__�s�����t�$��d�N�F���
�
�d�+��D�L�D���w�'7�'7��'=��t�O�G������	��������?�b�G������r/c�z�t|�t|�urtS|j|jk(xr�|j|jk(xrj|j|jk(xrO|j
|j
k(xr4|j|jk(xr|j|jk(Sr�)�type�NotImplementedr�r�r�rlr�r��r�others  r.�__eq__zExample.__eq__�s�����:�T�%�[�(�!�!��{�{�e�l�l�*�-��y�y�E�J�J�&�-��{�{�e�l�l�*�-��{�{�e�l�l�*�-��|�|�u�}�}�,�	-�
�|�|�u�}�}�,�	-r/c��t|j|j|j|j|j
f�Sr�)�hashr�r�r�rlr�r�s r.�__hash__zExample.__hash__�s3���T�[�[�$�)�)�T�[�[�$�+�+��\�\�#�$�	$r/)Nr#r#N)r>r�r�r�r�r�r�r/r.rr�s!��!�DEF���$	-�$r/rc�,�eZdZ	d�Zd�Zd�Zd�Zd�Zy)rc�v�	||_||_|j�|_||_||_||_yr�)�examples�	docstring�copyr7r-rar�)rr�r7r-rar�r�s       r.r�zDocTest.__init__s9��	�!��
�"����Z�Z�\��
���	� ��
���r/c�&�t|j�dk(rd}n3t|j�dk(rd}ndt|j�z}d|jj�d|j�d|j
�d	|j�d
|�d�S)Nr#zno examplesr)z	1 examplez%d examples�<rhz from r�� (z)>)r,r��	__class__r>r-rar�)rr�s  r.�__repr__zDocTest.__repr__%sp���t�}�}���"�$�H�
����
�1�
$�"�H�$�s�4�=�=�'9�9�H�����(�(����D�M�M�4�;�;��B�	Cr/c�z�t|�t|�urtS|j|jk(xr�|j|jk(xrj|j|jk(xrO|j
|j
k(xr4|j|jk(xr|j|jk(Sr�)r�r�r�r�r7r-rar�r�s  r.r�zDocTest.__eq__0s�����:�T�%�[�(�!�!��}�}����.�+��~�~����0�+��z�z�U�[�[�(�+��y�y�E�J�J�&�+��}�}����.�	+�
�{�{�e�l�l�*�	+r/c�p�t|j|j|j|jf�Sr�)r�r�r-rar�r�s r.r�zDocTest.__hash__;s&���T�^�^�T�Y�Y��
�
�t�{�{�K�L�Lr/c�$�t|t�stS|j�|jnd}|j�|jnd}|j|j
|t
|�f|j|j
|t
|�fkS)Nr�)rArr�r�r-ra�id)rr��self_lno�	other_lnos    r.�__lt__zDocTest.__lt__?sv���%��)�!�!�"&�+�+�"9�4�;�;�r��$)�L�L�$<�E�L�L�"�	����D�M�M�8�R��X�>����U�^�^�Y��5�	�B�C�	Dr/N)r>r�r�r�r�r�r�r�r�r/r.rr�s#���.�	C�	+�M�Dr/rc��eZdZ	ejdej
ejz�Zejdejej
zejz�Z	ejd�jZdd�Zd�Z
dd�Zd�Zejdej
�Zd	�Zejd
ej
�Zd�Zd�Zd
�Zy)ra�
        # Source consists of a PS1 line followed by zero or more PS2 lines.
        (?P<source>
            (?:^(?P<indent> [ ]*) >>>    .*)    # PS1 line
            (?:\n           [ ]*  \.\.\. .*)*)  # PS2 lines
        \n?
        # Want consists of any non-blank lines that do not start with PS1.
        (?P<want> (?:(?![ ]*$)    # Not a blank line
                     (?![ ]*>>>)  # Not a line starting with PS1
                     .+$\n?       # But any other line
                  )*)
        a�
        # Grab the traceback header.  Different versions of Python have
        # said different things on the first traceback line.
        ^(?P<hdr> Traceback\ \(
            (?: most\ recent\ call\ last
            |   innermost\ last
            ) \) :
        )
        \s* $                # toss trailing whitespace on the header.
        (?P<stack> .*?)      # don't blink: absorb stuff until...
        ^ (?P<msg> \w+ .*)   #     a line *starts* with alphanum.
        z^[ ]*(#.*)?$c��	|j�}|j|�}|dkDr1dj|jd�D�cgc]}||d��	c}�}g}d\}}|jj|�D]�}|j
|||j��||jd||j��z
}|j|||�\}	}
}}|j|	�s;|j
t|	||||t|jd��z|
���||jd|j�|j��z
}|j�}��|j
||d�|Scc}w)Nr#r}�r#r#rl)r�rlr�)�
expandtabs�_min_indentr�r��_EXAMPLE_RE�finditer�appendr��count�_parse_example�_IS_BLANK_OR_COMMENTrr,�groupr�)
r�stringr-�
min_indent�l�output�charnor��mr�r�r�r�s
             r.�parsezDocTestParser.parse|sp��	��"�"�$���%�%�f�-�
���>��Y�Y����T�8J�K�8J�1��*�+��8J�K�L�F��������!�!�*�*�6�2�A��M�M�&�����	�2�3��f�l�l�4������;�;�F��(�(��D�&�9�
-�V�W�d�G��,�,�V�4��
�
�w�v�t�W�+1�+5�c�!�'�'�(�:K�6L�+L�,3� 5�7�

�f�l�l�4�����A�E�E�G�<�<�F��U�U�W�F�#3�&	�
�
�f�V�W�o�&��
��3 Ls�Fc�D�	t|j||�|||||�Sr�)r�get_examples)rr�r7r-rar�s      r.�get_doctestzDocTestParser.get_doctest�s0��	��t�(�(���6���X�v�v�7�	7r/c�n�	|j||�D�cgc]}t|t�r|��c}Scc}wr�)r�rAr)rr�r-�xs    r.rzDocTestParser.get_examples�sC��		� �:�:�f�d�3�+�3�a��a��)��3�+�	+��+s�2c	���	t|jd��}|jd�jd�}|j||||�|j	|ddd|zdz||�dj|D�cgc]
}||dzd��c}�}|jd�}|jd�}	t|	�dkDrt
jd	|	d
�r|	d
=|j	|	d|z||t|�z�dj|	D�
cgc]}
|
|d��	c}
�}|jj|�}|r|jd�}nd}|j|||�}||||fScc}wcc}
w)Nrlr�r}r)rhr��r�z *$r�r�)
r,r�r��_check_prompt_blank�
_check_prefixr�ri�match�
_EXCEPTION_RE�
_find_options)
rr�r-r�rl�source_lines�slr�r��
want_lines�wlr�r�s
             r.r�zDocTestParser._parse_example�s|��		��Q�W�W�X�&�'���w�w�x�(�.�.�t�4��� � ��v�t�V�D����<���+�S��Z�#�-=�t�V�L����L�A�L�b�B�v�a�x�y�M�L�A�B��
�w�w�v����Z�Z��%�
��z�?�Q��2�8�8�F�J�r�N�#C��2�����:�s�6�z�4�!�C��$5�5�	7��y�y�
�;�
�"�"�V�W�+�
�;�<��
���$�$�T�*����g�g�e�n�G��G��$�$�V�T�6�:���w��g�-�-��/B��<s�<E-�E2z#\s*doctest:\s*([^\n\'"]*)$c
��	i}|jj|�D]x}|jd�jdd�j	�}|D]B}|ddvs|ddt
vrt
d|dz�d|�d|����t
|dd}|dd	k(||<�D�z|r%|j|�rt
d|�d|�d
|����|S)Nr)�,rhr#z+-�line z of the doctest for z has an invalid option: �+z4 has an option directive on a line with no example: )�_OPTION_DIRECTIVE_REr�r��replacer�r*r�r�)	rr�r-r�r�r��option_strings�option�flags	         r.r
zDocTestParser._find_options�s���	����*�*�3�3�F�;�A��W�W�Q�Z�/�/��S�9�?�?�A�N�(���1�I�T�)��1�2�J�&9�9�$�&,�Q�h��f�&>�?�?�+�6�!�"�:�6��!'���c�!1���
�)�<��t�0�0��8��$�d�F�4�5�
5��r/z
^([ ]*)(?=\S)c��	|jj|�D�cgc]
}t|���}}t|�dkDrt|�Sycc}wr1)�
_INDENT_RE�findallr,�min)rrkrl�indentss    r.r�zDocTestParser._min_indentsM��E�-1�_�_�-D�-D�Q�-G�H�-G�6�3�v�;�-G��H��w�<�!���w�<����	Is�A
c��	t|�D]E\}}t|�|dzk\s�||dzdk7s�$td||zdz�d|�d|||dz�d|����y)	NrrWrhrr)� of the docstring for z lacks blank after z: )�	enumerater,r�)r�linesrlr-r�r�r�s       r.rz!DocTestParser._check_prompt_blanksl��	�!��'�G�A�t��4�y�F�1�H�$��f�Q�h��3�)>� �"(��(�1�*�d�"&�v�f�Q�h�"7��"?�@�@�(r/c	��	t|�D]3\}}|s�	|j|�r�td||zdz�d|�d|����y)Nrr)rz& has inconsistent leading whitespace: )rr�r�)rr �prefixr-r�r�r�s       r.rzDocTestParser._check_prefix'sK��	�!��'�G�A�t��D�O�O�F�3� �"(��(�1�*�d�D�":�;�;�(r/N)z<string>)r>r�r�ri�compile�	MULTILINE�VERBOSEr��DOTALLr	rr�r�rrr�rr
rr�rrr�r/r.rrLs�����"�*�*���\�\�B�J�J�
&�(�K�,�B�J�J� ��Z�Z�"�,�,�
&����
2�4�M�&�2�:�:�o�6�<�<��%�N
7�+�*.�f&�2�:�:�&D�&(�l�l�4���8����,�b�l�l�;�J��@�	;r/rc�N�eZdZ	de�ddfd�Zdd�Zd�Zd�Zd�Zd	�Z	d
�Z
y)rFTc�>�	||_||_||_||_yr�)�_parser�_verbose�_recurse�_exclude_empty)r�verbose�parser�recurse�
exclude_emptys     r.r�zDocTestFinder.__init__@s&��	������
���
�+��r/Nc	��	|�&t|dd�}|�tdt|�����|durd}n|�tj|�}	tj
|�}|s%tj|�}|d|ddzdk(sd}|�d}n=|�!tj||j�}ntj|�}|sd}	|� |�i}n+|jj�}n|j�}|�|j|�d|vrd|d<g}|j||||||i�|j�|S#t$rd}Y��wxYw)Nr>zHDocTestFinder.find: name must be given when obj.__name__ doesn't exist: Fr#���z<]>r�)r5r�r�r?�	getmodule�
getsourcefile�getfile�	linecache�getlines�__dict__rMr��update�_find�sort)	r�objr-rNr7�
extraglobsror�testss	         r.r�zDocTestFinder.findVs}��!	�F�<��3�
�D�1�D��|� �"&�s�)�".�/�/��U�?��F�
�^��&�&�s�+�F�
	(��(�(��-�D�����s�+���A�w�t�B�C�y�(�E�1�$�4��|�#���%�$-�#5�#5�d�F�O�O�#L�L�$-�#5�#5�d�#;�L�#�#'�L��=��~������,�,�.���J�J�L�E��!��L�L��$��U�"� *�E�*�����
�
�5�#�t�V�\�5�"�E�
	�
�
�����Y�	 ��L�	 �s�	E�E�
Ec��	|�ytj|��|tj|�uStj|�r|j|juStj
|�stj|�rLt|d�r|jj}nt|d�r
|j}ny|j|k(Stj|�r|j|jk(St|d�r|j|jk(St|t�rytd��)NT�__objclass__r�z"object must be a class or function)r?r3�
isfunctionr8�__globals__�ismethoddescriptor�ismethodwrapperr^r@r�r>�isclassrA�propertyr�)rrN�object�obj_mods    r.�_from_modulezDocTestFinder._from_module�s��	��>��
�
�
�v�
&�
2��W�.�.�v�6�6�6�
�
�
��
'��?�?�f�&8�&8�8�8��(�(��0��%�%�f�-��v�~�.� �-�-�8�8�����.� �+�+����?�?�g�-�-�
�_�_�V�
$��?�?�f�&7�&7�7�7�
�V�\�
*��?�?�f�&7�&7�7�7�
���
)���A�B�Br/c�|�	|}	tj|�}tj|�S#t$rY� wxYwr�)r?�unwrapr��	isroutine)rr<�
maybe_routines   r.�_is_routinezDocTestFinder._is_routine�sH��	��
�	�#�N�N�=�9�M�� � ��/�/���	��	�s�/�	;�;c
�|�	|jrtd|z�t|�|vryd|t|�<|j|||||�}|�|j	|�tj|�r�|jrz|jj�D]]\}	}
|�d|	��}	|j|
�stj|
�s�4|j||
�s�G|j||
|	||||��_tj|�r�|jr�t|di�j�D]�\}	}
t|	t �st#dt%|	�����tj&|
�sQtj|
�s<tj|
�s't|
t �st#dt%|
�����|�d|	��}	|j||
|	||||���tj|�r�|jr�|jj�D]�\}	}
t|
t(t*f�r|
j,}
tj&|
�s&tj|
�st|
t.�s�c|j||
�s�v|�d|	��}	|j||
|	||||���yyy)NzFinding tests in %sr)r��__test__z3DocTestFinder.find: __test__ keys must be strings: z^DocTestFinder.find: __test__ values must be strings, functions, methods, classes, or modules: z
.__test__.)r*�printr��	_get_testr�r?r@r+r8�itemsrNrErIr:r5rArBr�r�rL�staticmethod�classmethod�__func__rF)rr>r<r-rNrr7�seen�test�valname�vals           r.r:zDocTestFinder._find�s]��	��=�=��'�$�.�/��c�7�d�?����R��W�
��~�~�c�4����E�����L�L������C� �T�]�]� #��� 2� 2� 4����%)�7�3���%�%�c�*�g�o�o�c�.B��%�%�f�c�2��J�J�u�c�7�F�L�$�d�,�
!5����C� �T�]�]� '��Z�� <� B� B� D����!�'�3�/�$�&*�7�m�&6�7�7� �)�)�#�.�'�/�/�#�2F��(�(��-��C��1E�$�'+�3�i�&2�3�3�/3�G�<���
�
�5�#�w��� �$�(�!E� �?�?�3��D�M�M� #��� 2� 2� 4�����c�L�+�#>�?��,�,�C��&�&�s�+�w���s�/C� ��h�/��'�'���4�)-�w�7�G��J�J�u�c�7�F�L�$�d�,�!5�%2�r/c��	t|t�r|}n7	|j�d}n'|j}t|t�st|�}|j||�}|jr|sy|�d}n(t|dd�xs|j}|dddk(r|dd}|jj|||||�S#ttf$rd}Y��wxYw)Nr�r�����.pycr�)rArB�__doc__rMrI�_find_linenor,r5r>r)r)	rr<r-rNr7rr�r�ras	         r.rRzDocTestFinder._get_test!s���	��c�3���I�
��;�;�&� "�I� #���I�%�i��5�$'�	�N�	�
�"�"�3��5�����y���>��H��v�z�4�8�K�F�O�O�H����}��&�#�C�R�=���|�|�'�'�	�5�$�(0�&�:�	:��%�~�.�
��	�
�s�6B9�9C
�C
c
���	d}t|dd�}tj|�r|�d}tj|�rc|�a|�yt	j
dt	jt|dd��z�}t|�D]\}}|j|�s�|}ntj|�r|j}t|t�r|j}tj|�r/t|dd�r"tj|�}	|j }tj$|�r|j&}tj(|�r|j*}tj,|�r|j.dz
}|�N|�|dzSt	j
d�}t1|t3|��D]}|j||�s�|cSy#t"$rYywxYw)Nr^r#z^\s*class\s*%s\br>�-r)z(^|.*:)\s*\w*("|\'))r5r?r@rErir#�escaperr�ismethodrVrArF�fgetrArK�__code__rI�istraceback�tb_frame�isframe�f_code�iscode�co_firstlineno�ranger,)rr<rr�r��patr�r�s        r.r_zDocTestFinder._find_linenoGs���	�
���C��D�1�	����C� �Y�%:��F�
�?�?�3��I�$9��#���*�*�0��Y�Y�w�s�J��'D�E�F�G�C�$�\�2���4��9�9�T�?��F��3����C� ����#��c�8�$��(�(�C����c�"�w�s�I�t�'D��.�.��%�C�
��l�l�����s�#�3�<�<�S��?�?�3��s�z�z���>�>�#���'�'�!�+�F����#��a�x���*�*�3�4�C����L�(9�:���9�9�\�&�1�2�!�M�;�
��1"�
��	
�s�G�	G&�%G&�NNNN)r>r�r�rr�r�rIrNr:rRr_r�r/r.rr7s=��� %�]�_��T�,�,d�LC�:	0�;,�z$:�L;r/rc��eZdZ	dZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zejd�Zdd�Zdd
�Zdd�Zd�Zy)rzF**********************************************************************Nc���	|xs
t�|_|�dtjv}||_||_||_d|_d|_i|_	t�|_y)N�-vr#)r�_checkerrFr�r*�optionflags�original_optionflags�tries�failures�_name2ftrz�_fakeout)r�checkerr-rss    r.r�zDocTestRunner.__init__�sc��	�  �2�=�?��
��?��c�h�h�&�G���
�&���$/��!���
���
���
�"���
r/c���	|jrf|jr8|dt|j�zdzt|j�z�y|dt|j�zdz�yy)NzTrying:
zExpecting:
zExpecting nothing
)r*r�rmr�)rr�rX�examples    r.�report_startzDocTestRunner.report_start�so��	��=�=��|�|��K�'�'�.�.�"9�9�"�#�%,�W�\�\�%:�;�<��K�'�'�.�.�"9�9�)�*�+�r/c�0�	|jr	|d�yy)Nzok
)r*�rr�rXr{r�s     r.�report_successzDocTestRunner.report_success�s��	��=�=���K�r/c��	||j||�|jj|||j�z�yr�)�_failure_headerrr�output_differencersr~s     r.�report_failurezDocTestRunner.report_failure�sC��	�	�D� � ��w�/��M�M�+�+�G�S�$�:J�:J�K�
L�	Mr/c�f�	||j||�dztt|��z�y)NzException raised:
)r�rmrx�rr�rXr{rss     r.�report_unexpected_exceptionz)DocTestRunner.report_unexpected_exceptions=��	�	�D� � ��w�/�!�
"�$+�,@��,J�$K�
L�	Mr/c���|jg}|jrf|j�)|j�|j|jzdz}nd}|jd|j�d|�d|j���n.|jd|jdz�d|j���|jd�|j
}|jt
|��dj|�S)	Nr)�?zFile "�", line �, in zLine zFailed example:r})�DIVIDERrar�r�r-r�rmr�)rrXr{r�r�r�s      r.r�zDocTestRunner._failure_headers����|�|�n���=�=��{�{�&�7�>�>�+E����w�~�~�5��9�����J�J��
�
�v�t�y�y�:�
;�
�J�J�7�>�>�!�+;�T�Y�Y�G�H��
�
�$�%������
�
�7�6�?�#��y�y��~�r/c
�J��	dx}}|j}td�\}}}	|jj}
t	|j
�D�]�\}}|jtzxr|dkD}
||_|jrP|jj�D]3\}}|r|xj|zc_�|xj|zc_�5|jtzr��|dz
}|
s|j|||�d|j|fz}	tt|j|d|d�|j�|j j#�d}|j*j-�}|j*j/d�|}|�#|
|j0||j��r|}�nt3j4|dd�}t7|dt8�rV|dj:�d�|dj<�d	|dj:�d�f�t?�fd
�t	|�D��}||d}djA|�}|
s|tC|�z
}|jD�|	}nf|
|jD||j�r|}nE|jtFzr2|
tI|jD�tI|�|j�r|}||ur|
sT|jK||||�n?||ur|
s|jM||||�|dz
}n||	ur|
s|jO||||�|dz
}|s���|jtPzs���n||_|jS|||�tU||�S#t$$r�t'j(�}|j j#�Y��HxYw)Nr#rWr)z<doctest %s[%d]>�singleT�r�r�c3�J�K�|]\}}|j��r|���y�wr�)r�)�.0�indexr��exception_line_prefixess   �r.�	<genexpr>z&DocTestRunner.__run.<locals>.<genexpr>xs*�����)�+B�K�E�4��?�?�+B�C��+B�s� #r�)+rsrlrr�check_outputrr�r
r�rSrr|r-�execr#r�r7�debuggerr��KeyboardInterruptrFrsrxrrr�r�rp�format_exception_only�
issubclass�SyntaxErrorr�r��nextr�rxr�rr�rr�r�r�_DocTestRunner__record_outcomer')rrX�compileflagsr�rvrurt�SUCCESS�FAILURE�BOOM�check�
examplenumr{�quiet�
optionflagrZra�	exceptionr��outcome�formatted_ex�
exc_msg_indexr�r�s                       @r.�__runzDocTestRunner.__runs����	����5� $�/�/��!&�q�����$��
�
�*�*��$-�T�]�]�#;��J���%�%�(A�A�"���\�
� 4�D�����)0���)>�)>�)@�%�Z����(�(�J�6�(��(�(�Z�K�7�(�	*A����$�&��
�Q�J�E���!�!�#�t�W�5�
*�T�Y�Y�
�,C�C�H�


-��W�W�^�^�X�x�)�4�1�26�*�*�>��
�
�*�*�,� �	��-�-�(�(�*�C��M�M�"�"�1�%��G�� �����s�D�,<�,<�=�%�G� )�>�>�	�"�1�
�N���i��l�K�8�%�Q�<�4�4�5�Q�7�$�Q�<�2�2�3�1�Y�q�\�5N�5N�4O�q�Q�/�+�%)�)�+4�\�+B�)�%�M�
$0�
��#?�L��'�'�,�/����/�	�:�:�C��?�?�*�"�G��7�?�?�G�T�5E�5E�F�%�G��%�%�(?�?��5�g�o�o�F�5�g�>�!�-�-�/�#*���'�!���'�'��T�7�C�@��G�#���'�'��T�7�C�@��A�
���D����4�4�S�$��5>�@��A�
���D�,�,�y�8��_$<�d0���	
���d�H�e�4��8�U�+�+��_%�
��
-��L�L�N�	��
�
�*�*�,�s
�A	M&�&9N"c���	|jj|jd�\}}||z||zf|j|j<|xj|z
c_|xj|z
c_y)Nr�)rwr4r-rvru)rrXre�t�f2�t2s      r.�__record_outcomezDocTestRunner.__record_outcome�s`��	����"�"�4�9�9�e�4���B�$%�b�D�!�B�$�<��
�
�d�i�i� ��
�
���
��
�
�a��
r/z.<doctest (?P<name>.+)\[(?P<examplenum>\d+)\]>$c�J�|jj|�}|ru|jd�|jjk(rM|jj
t
|jd��}|jjd��S|j||�S)Nr-r�T��keepends)
�%_DocTestRunner__LINECACHE_FILENAME_RErr�rXr-r��intr��
splitlines�save_linecache_getlines)rra�module_globalsr�r{s     r.�__patched_linecache_getlinesz*DocTestRunner.__patched_linecache_getlines�s���(�(�.�.�x�8��������D�I�I�N�N�2��i�i�(�(��Q�W�W�\�-B�)C�D�G��>�>�,�,�d�,�;�;��/�/��.�I�Ir/c�x�	�
�	||_|�t|j�}tj�
|�4�
j
�	�	��	j
�dk(r
�
j}n�	�
fd�}|jt_tj�}tj}t�
�|_
|jj�|jjt_tj |_|j$t_tj&}tj(t_	|j+|||��
t_|t_tj,|�|j"t_|t_|r&|jj/�ddl}d|_SS#�
t_|t_tj,|�|j"t_|t_|r&|jj/�ddl}d|_wwxYw)N�utf-8c�`��t|j�d���}�j|�y)N�backslashreplace)rB�encode�write)rkrZr�s ��r.r�zDocTestRunner.run.<locals>.out�s)����A�H�H�X�/A�B�H�M�A��%�%�a�(r/r#)rXr;r7rFr�rZ�lowerr�rx�gettracer�r�r�r��resetr6r7r��*_DocTestRunner__patched_linecache_getlines�displayhook�__displayhook__�_DocTestRunner__run�settrace�clear�builtins�_)rrXr�r��clear_globs�
save_trace�save_set_trace�save_displayhookr�rZr�s         @@r.�runzDocTestRunner.run�s����	�&��	���0����<�L��j�j���;�"�+�+�H���8�>�>�#3�w�#>�!�'�'��)��]�]��
��\�\�^�
�����-�k�:��
��
�
�����
�
�/�/��
�(1�'9�'9��$�!�>�>�	���?�?���-�-���	"��:�:�d�L�#�6�$�C�J�*�C�M��L�L��$�!%�!=�!=�I��.�C�O���
�
� � �"��!��
���%�C�J�*�C�M��L�L��$�!%�!=�!=�I��.�C�O���
�
� � �"��!��
��s
�>G�A5H9c��	|�|j}g}g}g}dx}}|jj�D]U}|\}\}	}
||
z
}||	z
}|
dk(r|j|��,|	dk(r|j||
f��E|j|��W|r{|r8t	t|�d�|j
�|D]}t	d|��|r?t	t|�d�|j
�|D]\}}t	d||fz��|rXt	|j�t	t|�d�|j
�|D]\}\}	}
t	d|	|
|fz��|r2t	|dt|j�d	�t	||z
d
|d�|rt	d|d
�n
|rt	d�t||�S)Nr#zitems had no tests:z   zitems passed all tests:z %3d tests in %szitems had failures:z %3d of %3d in %sztests inzitems.z
passed andzfailed.z***Test Failed***z	failures.zTest passed.)	r*rwrSr�rQr,r;r�r')
rr-�notests�passed�failed�totalt�totalfrr-rer��thingr�s
             r.�	summarizezDocTestRunner.summarizes���		��?��m�m�G��������������$�$�&�A��L�D�&�1�a��a�K�F��a�K�F��A�v����t�$��a���
�
��a�y�*��
�
�a� �'����c�'�l�$9�:�����$�E��%��'�%���c�&�k�#<�=����
�$*�L�E�5��,��u�~�=�>�%+���$�,�,���#�f�+�4�5��K�K�M�!'�
��v��1��)�Q��5�M�9�:�"(���&�*�c�$�-�-�&8�(�C��&�6�/�<���C���%�v�{�;�
��.�!��6�6�*�*r/c��|j}|jj�D]%\}\}}||vr||\}}||z}||z}||f||<�'yr�)rwrS)rr��dr-rer�r�r�s        r.�mergezDocTestRunner.mergeDs_���M�M��!�N�N�0�0�2�L�D�&�1�a��q�y�
�4����B���F����F����d�A�d�G�3r/)NNr#r��NNT)r>r�r�r�r�r|rr�r�r�r�r�rir#r�r�r�r�r�r�r/r.rr�sn��6�r�G�$�H+��M�M��(L,�\�)�b�j�j�*F�G��J�D"�R4+�rr/rc�&�eZdZ	d�Zd�Zd�Zd�Zy)rc�<�	t|jdd�d�S)N�ASCIIr�)rBr�)rrks  r.�_toAsciizOutputChecker._toAsciiYs"��	��1�8�8�G�%7�8�'�B�Br/c��	|j|�}|j|�}||k(ry|tzs||fdk(ry||fdk(ry|tzsNtjdtj
t�zd|�}tjdd|�}||k(ry|tzrDdj|j��}dj|j��}||k(ry|tzr
t||�ryy)	NT)zTrue
z1
)zFalse
z0
z(?m)^%s\s*?$r�z(?m)^[^\S\n]+$rhF)r�rrrirjrb�BLANKLINE_MARKERrr�r�rr��rr�r�rss    r.r�zOutputChecker.check_output_s��	��m�m�C� ���}�}�T�"���$�;���4�4��D�z�.�.���D�z�/�/���3�3��6�6�/�B�I�I�6F�,G�G��d�$�D��&�&�*�B��4�C��d�{��
�-�-��(�(�3�9�9�;�'�C��8�8�D�J�J�L�)�D��d�{����!��t�S�)��r/c��|ttztzzsy|tzry|jd�dkDxr|jd�dkDS)NFTr}r�)r
rrr�r�s    r.�_do_a_fancy_diffzOutputChecker._do_a_fancy_diff�sV���l�*�+�*�+�,����%���z�z�$��!�#�;��	�	�$��!�(;�;r/c���	|j}|tzstjdt|�}|j|||�r�|j
d��}|j
d��}|tzr)tj||d��}t|�dd}d}n||tzr)tj||d��}t|�dd}d}nJ|tzrAtjtj��}	t|	j!||��}d	}d
zt#dj%��zS|r|rdt#|��d
t#|���S|rdt#|�zS|rdt#|�zSy)Nz(?m)^[ ]*(?=
)Tr�r�)�nz#unified diff with -expected +actualz-context diff with expected followed by actual)�charjunkzndiff with -expected +actualzDifferences (%s):
r�z
Expected:
zGot:
zExpected:
%sGot nothing
zExpected nothing
Got:
%szExpected nothing
Got nothing
)r�rrirjr�r�r�r
�difflib�unified_diff�listr�context_diffr�Differ�IS_CHARACTER_JUNK�comparermr�)
rr{r�rsr�r
�	got_lines�diff�kind�engines
          r.r�zOutputChecker.output_difference�s[��	��|�|���3�3��&�&�*�,<�c�B�C�� � ��s�K�8����$��7�J������5�I��\�)��+�+�J�	�Q�G���D�z�!�"�~��<���|�+��+�+�J�	�Q�G���D�z�!�"�~��F���|�+� ����1J�1J�K���F�N�N�:�y�A�B��5��)�4�/�'�"�'�'�$�-�2H�H�H��C�.5�d�m�W�S�\�J�J�
�/�'�$�-�?�?�
�/�'�#�,�>�>�4r/N)r>r�r�r�r�r�r�r�r/r.rrQs���C�<�~<�.,5r/rc��eZdZ	d�Zd�Zy)rc�.�||_||_||_yr�)rXr{r�)rrXr{r�s    r.r�zDocTestFailure.__init__�s����	������r/c�,�t|j�Sr��rBrXr�s r.�__str__zDocTestFailure.__str__�����4�9�9�~�r/N�r>r�r�r�r�r�r/r.rr�s��	��
r/rc��eZdZ	d�Zd�Zy)rc�.�||_||_||_yr�)rXr{rs)rrXr{rss    r.r�zUnexpectedException.__init__s����	���� ��
r/c�,�t|j�Sr�r�r�s r.r�zUnexpectedException.__str__r�r/Nr�r�r/r.rr�s��	�!�
r/rc�"�eZdZ	dd�Zd�Zd�Zy)rNc�p�tj||||d�}|r|jj�|S)NF)rr�r7r�)rrXr�r�r��rs      r.r�zDebugRunner.runds2�����d�D�,��U�C����J�J�����r/c��t|||��r�)rr�s     r.r�z'DebugRunner.report_unexpected_exceptionjs��!�$���:�:r/c��t|||��r�)rr~s     r.r�zDebugRunner.report_failurems���T�7�C�0�0r/r�)r>r�r�r�r�r�r�r/r.rr	s��X�t�;�1r/rTFc	���	|�tjjd�}tj|�std|����|�|j}t|��}	|rt||��}
n
t||��}
|	j||||��D]}|
j|��|r|
j�t�|
a
ntj|
�t|
j |
j"�S)Nr�ztestmod: module required; )r0�r-rs�r7r=)rFrGr4r?r@rMr>rrrr�r�r��masterr�r'rvru)r�r-r7r-�reportrsr=�raise_on_errorr0�finder�runnerrXs            r.rrys���>�D	�y�
�K�K�O�O�J�'�����A���!�=�>�>��|��z�z����
7�F���W�+�F���w�K�H�����A�t�5�Z��H���
�
�4��I������
�~������V���v������5�5r/c��	|r
|std��t||||xsd�\}}|�tjj	|�}|�i}n|j�}|�|j
|�d|vrd|d<|	rt||��}
n
t||��}
|
j||||d�}|
j|�|r|
j�t�|
antj|
�t|
j|
j �S)N�8Package may only be specified for module-relative paths.r�r>r�rr#)r�rfr�r��basenamer�r9rrrr�r�rr�r'rvru)rarcr-rbr7r-rrsr=rr.rZ�textrrXs               r.rr�s��K�\���+�,�	,�$�H�g��$,�$7��9�N�D�(��|��w�w����)��
�}����
�
�����
���Z� ����&��j����W�+�F���w�K�H�����d�E�4��1�=�D�
�J�J�t��
�����
�~������V���v������5�5r/c��	t|d��}t||��}|j|||��D]}|j||���y)NF)r-r/r)r7)r�)rrr�r�)	rer7r-r-r�rsrrrXs	         r.rr\sJ��� �7�E�
:�F�
�7��
D�F����A�t�5��1���
�
�4�l�
�3�2r/c�H�	|tz|k7rtd|��t}|a|S)NzOnly reporting flags allowed)rr��_unittest_reportflags)r8�olds  r.rrys4���8	���E�)��7��?�?�
�C�!���Jr/c�l�eZdZ		d
d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Ze
jZd�Zy)�DocTestCaseNc��tjj|�||_||_||_||_||_yr�)�unittest�TestCaser��_dt_optionflags�_dt_checker�_dt_test�	_dt_setUp�_dt_tearDown)rrXrs�setUp�tearDownrys      r.r�zDocTestCase.__init__�s>��	���"�"�4�(�*���"�����
����$��r/c��|j}|jj�|_|j�|j	|�yyr�)rr7r��	_dt_globsr�rrXs  r.rzDocTestCase.setUp�s8���}�}�������*����>�>�%��N�N�4� �&r/c���|j}|j�|j|�|jj�|jj	|j
�yr�)rrr7r�r9rrs  r.rzDocTestCase.tearDown�sM���}�}�����(����d�#�	
�
�
�����
�
���$�.�.�)r/c��|j}tj}t�}|j}|t
zs	|tz}t||jd��}	d|_	|j||jd��\}}|t_|r.|j|j|j����y#|t_wxYw)NF�rsryr-zF----------------------------------------------------------------------)r�r�)rrFr�r$rrrrrr�r�r��failureException�format_failurerr)rrXr�newrsrrvrus        r.�runTestzDocTestCase.runTest�s����}�}���j�j���j���*�*���o�-�
�0�0�K��;�'+�'7�'7��H��	�#�F�N�$�j�j��#�)�)��)�8�O�H�e��C�J���'�'��(;�(;�C�L�L�N�(K�L�L����C�J�s�(C�
Cc
��|j}|j�d}nd|jz}dj|jj	d�dd�}d|j�d|j
�d|�d|�d	|��
S)
Nzunknown line numberz%sr�r��Failed doctest test for �	
  File "r�r�z

)rr�r�r-r�ra)r�errrXr��lnames     r.r#zDocTestCase.format_failure�sj���}�}���;�;��*�F��D�K�K�'�F����������-�b�c�2�3���9�9�d�m�m�V�U�C�A�	r/c���	|j�t|j|jd��}|j	|j
d��|j
�y)NFr!)r�)rrrrr�rr)rrs  r.r"zDocTestCase.debug�sN��?	�B	
�
�
����)=�)=�%)�%5�%5�u�F���
�
�4�=�=�e�
�4��
�
�r/c�.�|jjSr��rr-r�s r.r�zDocTestCase.id&	s���}�}�!�!�!r/c�D�t|�t|�urtS|j|jk(xrj|j|jk(xrO|j|jk(xr4|j
|j
k(xr|j|jk(Sr�)r�r�rrrrrr�s  r.r�zDocTestCase.__eq__)	s�����:�T�%�[�(�!�!��}�}����.�5��#�#�u�'<�'<�<�5��~�~����0�5�� � �E�$6�$6�6�5����5�#4�#4�4�		5r/c�p�t|j|j|j|jf�Sr�)r�rrrrr�s r.r�zDocTestCase.__hash__3	s3���T�)�)�4�>�>�4�;L�;L��%�%�'�(�	(r/c��|jjjd�}|d�ddj|dd��d�S)Nr�r�r��))rr-r�r�)rr-s  r.r�zDocTestCase.__repr__7	s:���}�}�!�!�'�'��,�� ��H�c�h�h�t�C�R�y�&9�:�:r/c�4�d|jjzS)Nz	Doctest: r-r�s r.�shortDescriptionzDocTestCase.shortDescription=	s���T�]�]�/�/�/�/r/)r#NNN)r>r�r�r�rrr%r#r"r�r�r�r�rGr�r3r�r/r.rr�sM��AE��%�!�*�M�0
�F�P"�5�(�;��n�n�G�0r/rc�(�eZdZd�Zd�Zd�Zd�ZeZy)�SkipDocTestCasec�>�||_tj|d�yr�)rNrr�)rrNs  r.r�zSkipDocTestCase.__init__A	s��������T�4�(r/c�&�|jd�y)Nz-DocTestSuite will not work with -O2 and above)�skipTestr�s r.rzSkipDocTestCase.setUpE	s���
�
�E�Fr/c��yr�r�r�s r.�	test_skipzSkipDocTestCase.test_skipH	���r/c�4�d|jjzS)NzSkipping tests from %s)rNr>r�s r.r3z SkipDocTestCase.shortDescriptionK	s��'�$�+�+�*>�*>�>�>r/N)r>r�r�r�rr:r3r�r�r/r.r5r5@	s��)�G�
�?��Gr/r5c��eZdZd�Zy)�
_DocTestSuitec��yr�r�)rr�s  r.�_removeTestAtIndexz _DocTestSuite._removeTestAtIndexS	r;r/N)r>r�r�r@r�r/r.r>r>Q	s��
r/r>c���	|�
t�}t|�}|j|||��}|sCtjj
dk\r&t
�}|jt|��|S|j�t
�}|D]b}t|j�dk(r�|js |j}|dddk(r|dd}||_|jt|fi|����d|S)Nrr�r#r\r]r�)rrPr�rFr8�optimizer>�addTestr5r;r,r�rar�r)	rNr7r=�test_finderr�r>�suiterXras	         r.rrW	s���!�F��#�o��
�v�
&�F����V�5�Z��H�E��S�Y�Y�'�'�!�+����
�
�
�o�f�-�.���	�J�J�L��O�E����t�}�}���"���}�}����H����}��&�#�C�R�=��$�D�M�
�
�
�k�$�2�'�2�3���Lr/c��eZdZd�Zd�Zd�Zy)�DocFileCasec�j�dj|jjjd��S)Nr�r�)r�rr-r�r�s r.r�zDocFileCase.id�	s&���x�x��
�
�*�*�0�0��5�6�6r/c�.�|jjSr�)rrar�s r.r�zDocFileCase.__repr__�	s���}�}�%�%�%r/c�h�d|jj�d|jj�d|��S)Nr'r(z", line 0

)rr-ra)rr)s  r.r#zDocFileCase.format_failure�	s(���=�=�%�%�t�}�}�'=�'=�s�D�	r/N)r>r�r�r�r�r#r�r/r.rGrG�	s��7�&�r/rGc��|�i}n|j�}|r
|std��t||||xsd�\}}d|vr||d<tjj|�}|j
||||d�}	t|	fi|��S)Nr	r�r�r#)r�r�rfr�r�r
rrG)
r�rcrbr7r.rZr��docr-rXs
          r.�DocFileTestrM�	s���
�}����
�
������+�,�	,��t�W�o�'�2�7�4�I�C����� ��j���7�7���D�!�D����c�5�$��a�8�D��t�'�w�'�'r/c��	t�}|jdd�rt|jd��|d<|D]}|jt	|fi|����|S)NrcTrb)r>r4rPrCrM)�paths�kwrEr�s    r.rr�	s`��6�n
�O�E�

�v�v���&�)�"�&�&��*;�<��9�
���
�
�
�k�$�-�"�-�.���Lr/c�`�	g}t�j|�D]�}t|t�rg|j	|j
dd�|j}|s�@|j	d�||jd�ddD�cgc]}d|z��	c}z
}�z||jd�ddD�cgc]
}t|���c}z
}��|r#|ddk(r|j�|r	|ddk(r�|r$|ddk(r|jd�|r	|ddk(r�dj|�dzScc}wcc}w)Nr�z# Expected:r}z## r�r#)rr�rArr�r�r�r�r��popr�)rkr��piecer�r�s     r.rr
s=��8�r�F���&�&�q�)���e�W�%��M�M�%�,�,�s��+�,��:�:�D���
�
�m�,��D�J�J�t�,<�S�b�,A�B�,A�q�5��7�,A�B�B��
� %���D� 1�#�2� 6�8� 6�1�%�Q�'� 6�8�
8�F�*��V�B�Z�3�&��
�
���V�B�Z�3�&�
�V�A�Y�#�%��
�
�1�
��V�A�Y�#�%��9�9�V��t�#�#��C��8s�D&�.D+c���	t|�}t�j|�}|D�cgc]}|j|k(s�|��}}|st	|d��|d}t|j�}|Scc}w)Nznot found in testsr#)rPrr�r-r�rr�)rNr-r>r�rX�testsrcs      r.r r Y
su����v�
&�F��O� � ��(�E��/�u�!����$��A�u�D�/����3�4�4���7�D�"�4�>�>�2�G��N��0s
�A/�A/c�6�	t|�}t|||�yr�)r�debug_script)�src�pmr7rUs    r.r!r!i
s��>�"�3�'�G���"�e�$r/c��	ddl}|r|j�}ni}|r	t|||�y|jd��jd|z||�y#tt	j
�d�|jd��}|j�|jdt	j
�d�YyxYw)Nr#r)T)r�r�zexec(%r))
r�r�r�rQrFrsr�r��interactionr�)rXrYr7r��ps     r.rWrWn
s���=����
�
�����	�	3���e�U�#�	������"�"�:��#3�U�E�B��
	3��#�,�,�.��#�$������&�A�
�G�G�I�
�M�M�$�����q� 1�2�s�
A�A,Cc�b�	t|�}t||�}t|||j�yr�)rPr rWr8)rNr-rYrUs    r.r"r"�
s/����v�
&�F����&�G���"�f�o�o�.r/c� �eZdZ	d�Zd�Zd�Zy)�
_TestClassc��	||_yr��rZ)rrZs  r.r�z_TestClass.__init__�
s��	���r/c�0�	|jdz|_|S)Nr�rar�s r.�squarez_TestClass.square�
s��	��8�8�q�=����r/c��	|jSr�rar�s r.r4z_TestClass.get�
s��	��x�x�r/N)r>r�r�r�rcr4r�r/r.r_r_�
s�����r/r_z�
                      Example of a string object, searched as-is.
                      >>> x = 1; y = 2
                      >>> x + y, x * y
                      (3, 2)
                      a�
                                    In 2.2, boolean expressions displayed
                                    0 or 1.  By default, we still accept
                                    them.  This can be disabled by passing
                                    DONT_ACCEPT_TRUE_FOR_1 to the new
                                    optionflags argument.
                                    >>> 4 == 4
                                    1
                                    >>> 4 == 4
                                    True
                                    >>> 4 > 4
                                    0
                                    >>> 4 > 4
                                    False
                                    z�
                Blank lines can be marked with <BLANKLINE>:
                    >>> print('foo\n\nbar\n')
                    foo
                    <BLANKLINE>
                    bar
                    <BLANKLINE>
            z�
                If the ellipsis flag is used, then '...' can be used to
                elide substrings in the desired output:
                    >>> print(list(range(1000))) #doctest: +ELLIPSIS
                    [0, 1, 2, ..., 999]
            a�
                If the whitespace normalization flag is used, then
                differences in whitespace are ignored.
                    >>> print(list(range(30))) #doctest: +NORMALIZE_WHITESPACE
                    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
                     15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
                     27, 28, 29]
            )r_r�zbool-int equivalencezblank lines�ellipsiszwhitespace normalizationc��ddl}|jd��}|jddddd�	�|jd
ddtj	�gd
��|jdddd��|jddd��|j�}|j}|j}d}|jD]}|t|z}�|jr	|tz}|D]�}|jd�rstjj|�\}}tjj!d|�t#|dd�}	tjd=t%|	||��\}
}nt'|d||��\}
}|
s��yy)Nr#zdoctest runner)�descriptionrqz	--verbose�
store_trueFz'print very verbose output for all tests)�action�default�helpz-oz--optionr�zqspecify a doctest option flag to apply to the test run; may be specified more than once to apply multiple options)ri�choicesrjrkz-fz--fail-fastzystop running tests after first failure (this is a shorthand for -o FAIL_FAST, and is in addition to any other -o options))rirkrorz file containing the tests to run)�nargsrkz.py���r)rcr-rsr))�argparse�ArgumentParser�add_argumentr*�keys�
parse_argsror-r�	fail_fastrr~r�r�r�rF�insertrCrr)ror.r��	testfilesr-r�rra�dirnamer�rvr�s            r.�_testrx�
s����
�
$�
$�1A�
$�
B�F�
����k�,��F��H�
����j�� 3� 8� 8� :�B�E��G�
����m�L�F��H�����c�?��A�����D��	�	�I��l�l�G��G��+�+���&�v�.�.����~�~��9��������U�#�!#���
�
�h� 7��G�X��H�H�O�O�A�w�'��8�C�R�=�)�A������!�!�W�'�J�K�H�a�"�8�U�-4�'�K�K�H�a����
r/r�)r�)r)	NNNNTr#NFF)F�NoNameNr#rn)FN)F)S�
__docformat__�__all__r2r�r?r6r�r�rirFrpr�ior$r%�collectionsr&r'r*rrrrrrrr	r
rrr
rrr�r�r;rPrUrfrmrxrzr�r�r�r�r�r[rrrrrr�	Exceptionrrrrrrrrrrrr5�	TestSuiter>rrGrMrrr r!rWr"r_rPrxr>�exitr�r/r.�<module>r�s7��%�N&�
�+��Z����	�
�	�
���2�"���(:�;��.��O�-�-E�F��+�,C�D��*�+A�B���z�*���6�"��-�.G�H��*�)�*�(�)����	�
,�,��#�>�2��"�>�2��"�>�2��/�0K�L����,�	��� �� �-�-��	��!����&
�>�2D�"�$/�	� �� �/�b��4"%�C�G�G�"%�J ,�\B$�B$�HGD�GD�Zd;�d;�VK�K�b
G�G�RP5�P5�d�Y��&�)��&e1�-�e1�\
��37�37�05�f6�P(,�$����d���U�=�?��y6�v:B�:;�4�6��!�Ha0�(�#�#�a0�F�k��"
�H�&�&�
�>�@�+��'+�D��=�?��(�4C�RP$�d� %�
C�(	/�*�*�X%��%(� ��)�Q0
��f*
�Z�z���C�H�H�U�W��r/

?>