ok

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/doctest.cpython-311.opt-2.pyc

�

�f9�����	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#dYd�Z$d�Z%d�Z&dZd�Z'd�Z(Gd�de
��Z)d �Z*d!�Z+d"�Z,Gd#�d$ej-��Z.d%�Z/Gd&�d'��Z0Gd(�d)��Z1Gd*�d+��Z2Gd,�d-��Z3Gd.�d/��Z4Gd0�d1��Z5Gd2�d3e6��Z7Gd4�d5e6��Z8Gd6�d7e4��Z9da:			d[d:�Z;d8ddddd8ddd9e2��dfd;�Z<		d\d=�Z=da>d>�Z?Gd?�d@ej@��ZAGdA�dBeA��ZBGdC�dDejC��ZDd]dE�ZEGdF�dGeA��ZFd8dde2��dfdH�ZGdI�ZHdJ�ZIdK�ZJd^dL�ZKd^dM�ZLd_dN�ZMGdO�dP��ZNeNdQdRdSdTdUdV�ZOdW�ZPeQdXkre	jReP����dSdS)`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�b�t�|dtt��z��S)N�)�OPTIONFLAGS_BY_NAME�
setdefault�len��names �./opt/alt/python311/lib64/python3.11/doctest.pyrr�s&���)�)�$��S�9L�5M�5M�0M�N�N�N�rrrrrrr
rrr
rz<BLANKLINE>z...c��	d}tjD]9}|�|d��}|tt|��ur
||jz}�:|S)Nr#)�
__future__�all_feature_names�get�getattr�
compiler_flag)�globs�flags�fname�features    r/�_extract_future_flagsr;�s[���
�E��-�+�+���)�)�E�4�(�(���g�j�%�0�0�0�0��W�*�*�E���Lr0�c�0�	tj|��r|St|t��r+t	|t��t
��dg��S|�/tjtj	|��j
dStd���)N�*�__name__z"Expected a module, string, or None)�inspect�ismodule�
isinstance�str�
__import__�globals�locals�sys�modules�	_getframe�	f_globals�	TypeError)�module�depths  r/�_normalize_modulerN�s���������>��
�	�F�C�	 �	 �>��&�'�)�)�V�X�X��u�=�=�=�	���{�3�=��/�/�9�*�E�F�F��<�=�=�=r0c�J�tdd���|d��S�NT)r%�decode)�datas r/�_newline_convertrS�s"��$�T�4�0�0�7�7��d�C�C�Cr0c��|r�t|d��}t||��}t|dd��x}�	|jj}n#t
$rYnwxYwt
|d��r;|�|��}|�|��}t|��|fSt||���5}|���|fcddd��S#1swxYwYdS)N��
__loader__�get_data)�encoding)rN�_module_relative_pathr5�__spec__�loader�AttributeError�hasattrrWrQrS�open�read)�filename�package�module_relativerXr[�
file_contents�fs       r/�_load_testfilere�s@���
=�#�G�Q�/�/��(��(�;�;���g�|�T�:�:�:�F�C�
� �)�0����!�
�
�
���
�����6�:�&�&�	=�"�O�O�H�5�5�M�)�0�0��:�:�M�$�M�2�2�H�<�<�	
�h��	*�	*�	*�"�a��v�v�x�x��!�"�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"�"�"s#�A�
A�A�0C�C�C�c�6�	tjd|dz|��S)Nz
(?m)^(?!$)� )�re�sub)�s�indents  r/�_indentrm�s!���
�6�,��s�
�A�.�.�.r0c��	t��}|\}}}tj||||���|���S)N)�file)r$�	traceback�print_exception�getvalue)�exc_info�excout�exc_type�exc_val�exc_tbs     r/�_exception_tracebackrx�sH���
�Z�Z�F� (��H�g�v�
��h���f�E�E�E�E��?�?���r0c��eZdZd�Zdd�ZdS)�	_SpoofOutc�f�tj|��}|r|�d��s|dz
}|S�N�
)r$rr�endswith)�self�results  r/rrz_SpoofOut.getvalues=���"�4�(�(���	�&�/�/�$�/�/�	��d�N�F��
r0Nc�X�|�|��tj|��dS�N)�seekr$�truncate)r�sizes  r/r�z_SpoofOut.truncate
s(���	�	�$������$�����r0r�)r?�
__module__�__qualname__rrr��r0r/rzrzs7��������� � � � � � r0rzc���	t|vr||kS|�t��}dt|��}}|d}|r*|�|��rt|��}|d=ndS|d}|r-|�|��r|t|��z}|d=ndS||krdS|D]4}|�|||��}|dkrdS|t|��z
}�5dS)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�v�H��1����5�
�2��A����<�<��?�?�	��c�!�f�f��F��2����5��&����u�
�����8�8�A�x��0�0���a�<�<��5�5��C��F�F�����4r0c�>�	|���}|rd|zSdS)Nz# �#)�rstrip)�lines r/�
_comment_liner�@s)��/��;�;�=�=�D����D�y���sr0c���dt|��}}|�d��}|dkr|}|�dd|��}|dkr|}|�dd|��}|dkr|dz}|||�S)Nr#r}�:�.r))r,r��rfind)�msg�start�end�is    r/�_strip_exception_detailsr�Hs����C��H�H�3�E�������A��A�v�v�������a����A��A�v�v����	�	�#�q�#���A��A�v�v��!����u�c�z�?�r0c�*�eZdZ	d�Zdd�Zd�Zd�ZdS)�_OutputRedirectingPdbc�t�||_d|_tj�||d���d|_dS)NFT)�stdout�nosigintr))�_OutputRedirectingPdb__out�$_OutputRedirectingPdb__debugger_used�pdb�Pdb�__init__�use_rawinput)r�outs  r/r�z_OutputRedirectingPdb.__init__hs<����
�$��������c�D��9�9�9�����r0Nc��d|_|�tj��j}tj�||��dSrP)r�rGrI�f_backr�r��	set_trace)r�frames  r/r�z_OutputRedirectingPdb.set_traceps;��#����=��M�O�O�*�E�����$��&�&�&�&�&r0c�V�|jr!tj�|��dSdSr�)r�r�r��set_continue�rs r/r�z"_OutputRedirectingPdb.set_continuevs5����	'��G� � ��&�&�&�&�&�	'�	'r0c��tj}|jt_	tjj|g|�R�|t_S#|t_wxYwr�)rGr�r�r�r��trace_dispatch)r�args�save_stdouts   r/r�z$_OutputRedirectingPdb.trace_dispatch|sK���j���Z��
�	%��7�)�$�6��6�6�6�$�C�J�J���C�J�$�$�$�$s�A�Ar�)r?r�r�r�r�r�r�r�r0r/r�r�bsZ�������
���'�'�'�'�'�'�'�%�%�%�%�%r0r�c��tj|��std|z���|�d��rt	d���tjj|�d���}t|d��r+t
j�|j
��d}n�|jdkrvttj��dkrLtjddkr6t
j�tjd��d}n�t
j}ntt|d��rM|jD]E}t
j�||��}t
j�|��r|cS�Ft	d	|jz���t
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@rArKr��
ValueError�os�path�joinr�r]r�r?r,rG�argv�curdirr��exists)rL�	test_path�basedir�	directory�fullpaths     r/rYrY�s�����F�#�#�:��/�&�8�9�9�9����C� � �N��L�M�M�M����y���s�3�3�5�I��v�z�"�"�,��'�-�-���0�0��3���	��J�	&�	&��s�x�=�=��?�?�s�x��{�b�0�0��g�m�m�C�H�Q�K�0�0��3�G�G��i�G�G��6�:�&�&�	$�#�_�
$�
$�	��7�<�<�	�9�=�=���7�>�>�(�+�+�$�#�O�O�O�$��3�!�?�+�,�,�	,�
�7�<�<���+�+�+r0c�(�eZdZ			dd�Zd�Zd�ZdS)rNr#c��|�d��s|dz
}|r|�d��s|dz
}|�|�d��s|dz
}||_||_||_||_|�i}||_||_dSr|)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��������r0c��t|��t|��urtS|j|jkoO|j|jko?|j|jko/|j|jko|j|jko|j|jkSr�)�type�NotImplementedr�r�r�rlr�r��r�others  r/�__eq__zExample.__eq__�s�����:�:�T�%�[�[�(�(�!�!��{�e�l�*�-��y�E�J�&�-��{�e�l�*�-��{�e�l�*�-��|�u�}�,�	-�
�|�u�}�,�	-r0c�\�t|j|j|j|j|jf��Sr�)�hashr�r�r�rlr�r�s r/�__hash__zExample.__hash__�s.���T�[�$�)�T�[�$�+��\�#�$�$�	$r0)Nr#r#N)r?r�r�r�r�r�r�r0r/rr�sV������!�DEF������$	-�	-�	-�$�$�$�$�$r0rc�.�eZdZ	d�Zd�Zd�Zd�Zd�ZdS)rc��	||_||_|���|_||_||_||_dSr�)�examples�	docstring�copyr7r.r`r�)rr�r7r.r`r�r�s       r/r�zDocTest.__init__s?��	�!��
�"����Z�Z�\�\��
���	� ��
�����r0c���t|j��dkrd}n2t|j��dkrd}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.r`r�)rr�s  r/�__repr__zDocTest.__repr__s����t�}����"�"�$�H�H�
���
�
�1�
$�
$�"�H�H�$�s�4�=�'9�'9�9�H����(�(�(�����D�M�M�M�4�;�;�;����B�	Cr0c��t|��t|��urtS|j|jkoO|j|jko?|j|jko/|j|jko|j|jko|j|jkSr�)r�r�r�r�r7r.r`r�r�s  r/r�zDocTest.__eq__*s�����:�:�T�%�[�[�(�(�!�!��}���.�+��~���0�+��z�U�[�(�+��y�E�J�&�+��}���.�	+�
�{�e�l�*�	+r0c�P�t|j|j|j|jf��Sr�)r�r�r.r`r�r�s r/r�zDocTest.__hash__5s!���T�^�T�Y��
�t�{�K�L�L�Lr0c���t|t��stS|j�|jnd}|j�|jnd}|j|j|t
|��f|j|j|t
|��fkS)Nr�)rBrr�r�r.r`�id)rr��self_lno�	other_lnos    r/�__lt__zDocTest.__lt__9sv���%��)�)�	"�!�!�"&�+�"9�4�;�;�r��$)�L�$<�E�L�L�"�	���D�M�8�R��X�X�>���U�^�Y��5�	�	�B�C�	Dr0N)r?r�r�r�r�r�r�r�r�r0r/rr�so�������.���	C�	C�	C�	+�	+�	+�M�M�M�D�D�D�D�Dr0rc�N�eZdZ	ejdejejz��Zejdejejzejz��Z	ejd��j
Zdd�Zd�Z
dd�Zd�Zejd	ej��Zd
�Zejdej��Zd�Zd
�Zd�ZdS)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^[ ]*(#.*)?$�<string>c���	|���}|�|����dkr4d��fd�|�d��D����}g}d\}}|j�|��D�],}|�|||������||�d||�����z
}|�	|||��\}}}	}
|�
|��sK|�t||	|
|�t|�
d����z|�����||�d|���|�����z
}|���}��.|�||d���|S)Nr#r}c�$��g|]}|�d���
Sr�r�)�.0�l�
min_indents  �r/�
<listcomp>z'DocTestParser.parse.<locals>.<listcomp>�s!���K�K�K�1��*�+�+��K�K�Kr0�r#r#rl)r�rlr�)�
expandtabs�_min_indentr�r��_EXAMPLE_RE�finditer�appendr��count�_parse_example�_IS_BLANK_OR_COMMENTrr,�groupr�)r�stringr.�output�charnor��mr�r�r�r�r�s           @r/�parsezDocTestParser.parsevs����	��"�"�$�$���%�%�f�-�-�
���>�>��Y�Y�K�K�K�K����T�8J�8J�K�K�K�L�L�F��������!�*�*�6�2�2�	�	�A��M�M�&�����	�	�!1�2�3�3�3��f�l�l�4�������;�;�;�F��(�(��D�&�9�9�
-�V�W�d�G��,�,�V�4�4�
7��
�
�w�v�t�W�+1�+5�c�!�'�'�(�:K�:K�6L�6L�+L�,3� 5� 5� 5�7�7�7�

�f�l�l�4������A�E�E�G�G�<�<�<�F��U�U�W�W�F�F��
�
�f�V�W�W�o�&�&�&��
r0c�T�	t|�||��|||||��Sr�)r�get_examples)rr�r7r.r`r�s      r/�get_doctestzDocTestParser.get_doctest�s8��	��t�(�(���6�6���X�v�v�7�7�	7r0c�D�	d�|�||��D��S)Nc�<�g|]}t|t���|��Sr�)rBr)r��xs  r/r�z.DocTestParser.get_examples.<locals>.<listcomp>�s6��+�+�+�a��a��)�)�+��+�+�+r0)r)rr�r.s   r/rzDocTestParser.get_examples�s5��		�+�+�4�:�:�f�d�3�3�+�+�+�	+r0c	�H�
�	t|�d�����
|�d���d��}|�|�
||��|�|dd�d�
zdz||��d��
fd�|D����}|�d��}|�d��}t|��dkrt
jd	|d
��r|d
=|�|d�
z||t|��z��d��
fd�|D����}|j�|��}|r|�d��}nd}|�	|||��}	||	||fS)
Nrlr�r}r)rhr�c�*��g|]}|�dzd���S)rfNr�)r��slrls  �r/r�z0DocTestParser._parse_example.<locals>.<listcomp>�s%���A�A�A�b�B�v�a�x�y�y�M�A�A�Ar0r�z *$r�c�$��g|]}|�d���
Sr�r�)r��wlrls  �r/r�z0DocTestParser._parse_example.<locals>.<listcomp>�s!���;�;�;�"�"�V�W�W�+�;�;�;r0r�)
r,r�r��_check_prompt_blank�
_check_prefixr�ri�match�
_EXCEPTION_RE�
_find_options)rrr.r��source_linesr�r��
want_linesr�r�rls          @r/r�zDocTestParser._parse_example�s����		��Q�W�W�X�&�&�'�'���w�w�x�(�(�.�.�t�4�4��� � ��v�t�V�D�D�D����<����+�S��Z�#�-=�t�V�L�L�L����A�A�A�A�L�A�A�A�B�B��
�w�w�v�����Z�Z��%�%�
��z�?�?�Q���2�8�F�J�r�N�#C�#C���2�����:�s�6�z�4�!�C��$5�$5�5�	7�	7�	7��y�y�;�;�;�;�
�;�;�;�<�<��
��$�$�T�*�*���	��g�g�e�n�n�G�G��G��$�$�V�T�6�:�:���w��g�-�-r0z#\s*doctest:\s*([^\n\'"]*)$c
���	i}|j�|��D]�}|�d���dd�����}|D]\}|ddvs|dd�t
vrt
d|dz�d|�d|�����t
|dd�}|dd	k||<�]��|r-|�|��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/rzDocTestParser._find_options�s6��	����*�3�3�F�;�;�		3�		3�A��W�W�Q�Z�Z�/�/��S�9�9�?�?�A�A�N�(�
3�
3���1�I�T�)�)��1�2�2�J�&9�9�9�$�*�&,�Q�h�h�h����f�f�&>�?�?�?�+�6�!�"�"�:�6��!'���c�!1���
�
�
3��	5�t�0�0��8�8�	5��*�$�f�f�d�d�d�F�F�4�5�5�
5��r0z
^([ ]*)(?=\S)c��	d�|j�|��D��}t|��dkrt|��SdS)Nc�,�g|]}t|����Sr�)r,)r�rls  r/r�z-DocTestParser._min_indent.<locals>.<listcomp>
s��H�H�H�6�3�v�;�;�H�H�Hr0r#)�
_INDENT_RE�findallr,�min)rrk�indentss   r/r�zDocTestParser._min_indentsJ��E�H�H�T�_�-D�-D�Q�-G�-G�H�H�H���w�<�<�!����w�<�<���1r0c���	t|��D]V\}}t|��|dzkr;||dzdkr,td||zdz�d|�d|||dz��d|������WdS)	NrfrUrhrr)� of the docstring for z lacks blank after z: )�	enumerater,r�)r�linesrlr.r�r�r�s       r/rz!DocTestParser._check_prompt_blanks���	�!��'�'�	@�	@�G�A�t��4�y�y�F�1�H�$�$��f�Q�h��3�)>�)>� �j�"(��(�1�*�*�*�d�d�d�"&�v�f�Q�h��"7�"7�"7���"?�@�@�@��	@�	@r0c	��	t|��D]:\}}|r3|�|��std||zdz�d|�d|������;dS)Nrr)r%z& has inconsistent leading whitespace: )r&r�r�)rr'�prefixr.r�r�r�s       r/rzDocTestParser._check_prefix!s|��	�!��'�'�	;�	;�G�A�t��
;�D�O�O�F�3�3�
;� �j�"(��(�1�*�*�*�d�d�d�D�D�":�;�;�;��	;�	;r0N)r�)r?r�r�ri�compile�	MULTILINE�VERBOSEr��DOTALLrrr�rrrr�rrr r�rrr�r0r/rrFsD��������"�*���\�B�J�
&�(�(�K�,�B�J� ��Z�"�,�
&���
2�4�4�M�&�2�:�o�6�6�<��%�%�%�%�N
7�
7�
7�+�+�+�+�*.�*.�*.�f&�2�:�&D�&(�l�4�4�����8���,�b�l�;�;�J����@�@�@�	;�	;�	;�	;�	;r0rc�V�eZdZ	de��ddfd�Zdd�Zd�Zd�Zd�Zd	�Z	d
�Z
dS)rFTc�@�	||_||_||_||_dSr�)�_parser�_verbose�_recurse�_exclude_empty)r�verbose�parser�recurse�
exclude_emptys     r/r�zDocTestFinder.__init__:s,��	������
���
�+����r0Nc	���	|�2t|dd��}|�tdt|�������|durd}n|�tj|��}	tj|��}|s-tj|��}|d|dd�zdksd}|�d}nH|�tj||j	��}ntj|��}|sd}n#t$rd}YnwxYw|�|�i}n.|j	���}n|���}|�|�|��d|vrd|d<g}|�
||||||i��|���|S)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__rKr��update�_find�sort)	r�objr.rLr7�
extraglobsror�testss	         r/r�zDocTestFinder.findPs���!	�F�<��3�
�D�1�1�D��|� �j�"&�s�)�)�)�".�/�/�/��U�?�?��F�F�
�^��&�s�+�+�F�
	(��(��-�-�D��
?���s�+�+���A�w�t�B�C�C�y�(�E�1�1�$�4��|�#����%�$-�#5�d�F�O�#L�#L�L�L�$-�#5�d�#;�#;�L�#�(�#'�L���+�	 �	 �	 ��L�L�L�	 ����0�=��~������,�,�.�.����J�J�L�L�E��!��L�L��$�$�$��U�"�"� *�E�*�����
�
�5�#�t�V�\�5�"�E�E�E�
	�
�
�����s�C�C!� C!c�L�	|�dStj|���|tj|��uStj|��r|j|juStj|��stj|��rBt|d��r
|jj	}nt|d��r|j	}ndS|j
|kStj|��r|j
|j	kSt|d��r|j
|j	kSt|t��rdStd���)NT�__objclass__r�z"object must be a class or function)r@r:�
isfunctionr?�__globals__�ismethoddescriptor�ismethodwrapperr]rGr�r?�isclassrB�propertyr�)rrL�object�obj_mods    r/�_from_modulezDocTestFinder._from_module�s@��	��>��4�
�
�v�
&�
&�
2��W�.�v�6�6�6�6�
�
��
'�
'�	C��?�f�&8�8�8��(��0�0�	C��%�f�-�-�	C��v�~�.�.�
� �-�8������.�.�
� �+����t��?�g�-�-�
�_�V�
$�
$�	C��?�f�&7�7�7�
�V�\�
*�
*�	C��?�f�&7�7�7�
���
)�
)�	C��4��A�B�B�Br0c�|�	|}	tj|��}n#t$rYnwxYwtj|��Sr�)r@�unwrapr��	isroutine)rrC�
maybe_routines   r/�_is_routinezDocTestFinder._is_routine�sU��	��
�	�#�N�=�9�9�M�M���	�	�	��D�	����� ��/�/�/s��
'�'c
���	|jrtd|z��t|��|vrdSd|t|��<|�|||||��}|�|�|��tj|��r�|jr�|j�	��D]f\}	}
|�d|	��}	|�
|
��stj|
��r1|�||
��r|�
||
|	||||���gtj|��r�|jr�t|di���	��D]�\}	}
t|	t ��st#dt%|	�������tj|
��s\tj|
��sHtj|
��s4t|
t ��st#dt%|
�������|�d|	��}	|�
||
|	||||����tj|��r�|jr�|j�	��D]�\}	}
t|
t(t*f��r|
j}
tj|
��s)tj|
��st|
t.��r8|�||
��r"|�d|	��}	|�
||
|	||||����dSdSdS)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__.)r1�printr��	_get_testr�r@rAr2r?�itemsrUrLrPrAr5rBrCr�r�rS�staticmethod�classmethod�__func__rM)rrErCr.rLrr7�seen�test�valname�vals           r/rAzDocTestFinder._find�sc��	��=�	0��'�$�.�/�/�/��c�7�7�d�?�?��F���R��W�W�
��~�~�c�4����E�E�����L�L�������C� � �	,�T�]�	,� #�� 2� 2� 4� 4�
,�
,����%)�T�T�7�7�3���%�%�c�*�*�,�g�o�c�.B�.B�,��%�%�f�c�2�2�,��J�J�u�c�7�F�L�$�d�,�,�,����C� � �	(�T�]�	(� '��Z�� <� <� B� B� D� D�

(�

(����!�'�3�/�/�7�$�*�&*�7�m�m�m�&6�7�7�7� �)�#�.�.�3�'�/�#�2F�2F�3��(��-�-�3�1;�C��1E�1E�3�$�*�'+�3�i�i�i�&2�3�3�3�/3�d�d�G�G�<���
�
�5�#�w��� �$�(�(�(�(��?�3���	,�D�M�	,� #�� 2� 2� 4� 4�
,�
,�����c�L�+�#>�?�?�'��,�C��&�s�+�+�,�w��s�/C�/C�,� ��h�/�/�,��'�'���4�4�,�*.���w�w�7�G��J�J�u�c�7�F�L�$�d�,�,�,��	,�	,�	,�	,�
,�
,r0c��	t|t��r|}nP	|j�d}n+|j}t|t��st|��}n#ttf$rd}YnwxYw|�||��}|jr|sdS|�d}n0t|dd��p|j}|dd�dkr
|dd�}|j	�
|||||��S)Nr�r�����.pycr�)rBrC�__doc__rKr\�_find_linenor3r5r?r0r)	rrCr.rLr7rr�r�r`s	         r/rYzDocTestFinder._get_tests!��	��c�3���	��I�I�
��;�&� "�I�I� #��I�%�i��5�5�3�$'�	�N�N�	����~�.�
�
�
��	�	�	�
�����"�"�3��5�5����	�y�	��4��>��H�H��v�z�4�8�8�K�F�O�H�����}��&�&�#�C�R�C�=���|�'�'�	�5�$�(0�&�:�:�	:s�5A�A'�&A'c
��	d}t|dd��}tj|��r|�d}tj|��rl|�j|�dSt	jdt	jt|dd����z��}t|��D]\}}|�|��r|}n�tj	|��r|j
}t|t��r|j
}tj|��r*t|dd��rtj|��j}tj|��r|j}tj|��r|j}tj|��r
|jdz
}|�Z|�|dzSt	jd��}t/|t1|����D]!}|�||��r|cS�"dS)Nrer#z^\s*class\s*%s\br?�-r)z(^|.*:)\s*\w*("|\'))r5r@rArLrir*�escaper&r�ismethodr]rBrM�fgetrHrR�__code__�istraceback�tb_frame�isframe�f_code�iscode�co_firstlineno�ranger,)rrCrr�r��patr�r�s        r/rfzDocTestFinder._find_linenoAs���	�
���C��D�1�1�	���C� � �	�Y�%:��F�
�?�3���	�I�$9��#��t��*�0��Y�w�s�J��'D�'D�E�E�F�G�G�C�$�\�2�2�
�
���4��9�9�T�?�?���F��E��
��C� � �4���#��c�8�$�$�	��(�C���c�"�"�	/�w�s�I�t�'D�'D�	/��.��%�%�.�C���s�#�#�7�3�<�S��?�3���1�s�z���>�#���	,��'�!�+�F����#��a�x���*�3�4�4�C����L�(9�(9�:�:�
"�
"���9�9�\�&�1�2�2�"�!�M�M�M�"��tr0�NNNN)r?r�r�rr�r�rPrUrArYrfr�r0r/rr1s�������� %�]�]�_�_��T�,�,�,�,�,d�d�d�d�LC�C�C�:	0�	0�	0�;,�;,�;,�z$:�$:�$:�L4�4�4�4�4r0rc��eZdZ	dZdd�Zd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zej
d��Zdd
�Zdd�Zdd�Zd�ZdS)rzF**********************************************************************Nr#c���	|p
t��|_|�dtjv}||_||_||_d|_d|_i|_	t��|_dS)N�-vr#)r�_checkerrGr�r1�optionflags�original_optionflags�tries�failures�_name2ftrz�_fakeout)r�checkerr4rzs    r/r�zDocTestRunner.__init__�si��	�  �2�=�?�?��
��?��c�h�&�G���
�&���$/��!���
���
���
�"����
�
�
r0c���	|jrf|jr:|dt|j��zdzt|j��z��dS|dt|j��zdz��dSdS)NzTrying:
zExpecting:
zExpecting nothing
)r1r�rmr�)rr�r_�examples    r/�report_startzDocTestRunner.report_start�s���	��=�	+��|�
+���K�'�'�.�"9�"9�9�"�#�%,�W�\�%:�%:�;�<�<�<�<�<���K�'�'�.�"9�"9�9�)�*�+�+�+�+�+�	+�	+r0c�0�	|jr
|d��dSdS)Nzok
)r1�rr�r_r�r�s     r/�report_successzDocTestRunner.report_success�s.��	��=�	��C��K�K�K�K�K�	�	r0c��	||�||��|j�|||j��z��dSr�)�_failure_headerry�output_differencerzr�s     r/�report_failurezDocTestRunner.report_failure�s^��	�	��D� � ��w�/�/��M�+�+�G�S�$�:J�K�K�
L�	M�	M�	M�	M�	Mr0c��	||�||��dztt|����z��dS)NzException raised:
)r�rmrx�rr�r_r�rss     r/�report_unexpected_exceptionz)DocTestRunner.report_unexpected_exception�s`��	�	��D� � ��w�/�/�!�
"�$+�,@��,J�,J�$K�$K�
L�	M�	M�	M�	M�	Mr0c��|jg}|jrL|j�|j�|j|jzdz}nd}|�d|j�d|�d|j����n(|�d|jdz�d|j����|�d��|j}|�t
|����d�|��S)	Nr)�?zFile "�", line �, in zLine zFailed example:r})�DIVIDERr`r�r�r.r�rmr�)rr_r�r�r�r�s      r/r�zDocTestRunner._failure_header�s����|�n���=�	I��{�&�7�>�+E���w�~�5��9������J�J�J��
�
�
�v�v�v�t�y�y�:�
;�
;�
;�
;�
�J�J�J�7�>�!�+;�+;�+;�T�Y�Y�G�H�H�H��
�
�$�%�%�%�����
�
�7�6�?�?�#�#�#��y�y��~�~�r0c
���	dx}}|j}td��\}}}	|jj}
t	|j��D�]\}}|jtzo|dk}
||_|jrC|j���D])\}}|r|xj|zc_�|xj|zc_�*|jtzr�||dz
}|
s|�
|||��d|j|fz}	tt|j|d|d��|j��|j���d}n=#t$$r�t'j��}|j���YnxYw|j���}|j�d��|}|�|
|j||j��r|}�n t3j|dd��}t7|dt8��r`|dj�d�|dj�d	|dj�d�f�t?�fd
�t	|��D����}||d�}d� |��}|
s|tC|��z
}|j"�|	}n\|
|j"||j��r|}nB|jtFzr3|
tI|j"��tI|��|j��r|}||ur|
s|�%||||��nG||ur |
s|�&||||��|dz
}n#||	ur|
s|�'||||��|dz
}|r|jtPzrn��||_|�)|||��tU||��S)Nr#rUr)z<doctest %s[%d]>�singleTr<r�r�c3�L�K�|]\}}|�����|V��dSr�)r�)r��indexr��exception_line_prefixess   �r/�	<genexpr>z&DocTestRunner.__run.<locals>.<genexpr>ksN�����)�)�'�E�4��?�?�+B�C�C�)��)�)�)�)�)�)r0r�)+rzrsry�check_outputr&r�r
r�rZrr�r.�execr*r�r7�debuggerr��KeyboardInterruptrGrsrrrr�r�rp�format_exception_only�
issubclass�SyntaxErrorr�r��nextr�rxr�rr�r�r�r�r�_DocTestRunner__record_outcomer')rr_�compileflagsr�r}r|r{�SUCCESS�FAILURE�BOOM�check�
examplenumr��quiet�
optionflagrar`�	exceptionr��outcome�formatted_ex�
exc_msg_indexr�r�s                       @r/�__runzDocTestRunner.__runs����	����5� $�/��!&�q������$��
�*��$-�T�]�#;�#;�o	�o	��J���%�(A�A�"���\�
� 4�D����
8�)0��)>�)>�)@�)@�8�8�%�Z���8��(�(�J�6�(�(�(��(�(�Z�K�7�(�(�(���$�&�
��
�Q�J�E��
6��!�!�#�t�W�5�5�5�
*�T�Y�
�,C�C�H�


-��W�W�^�X�x�)�4�1�1�26�*�>�>�>��
�*�*�,�,�,� �	�	��$�
�
�
��
-��L�N�N�	��
�*�*�,�,�,�,�,�����-�(�(�*�*�C��M�"�"�1�%�%�%��G�� ��5���s�D�,<�=�=�&�%�G�� )�>�	�"�1�"�
�N���i��l�K�8�8�@�%�Q�<�4�7�7�7�$�Q�<�2�Q�Q�Y�q�\�5N�Q�Q�Q�/�+�%)�)�)�)�)�+4�\�+B�+B�)�)�)�%�%�M�
$0�
���#?�L��'�'�,�/�/���;��/�	�:�:�:�C��?�*�"�G�G��U�7�?�G�T�5E�F�F�*�%�G�G��%�(?�?�*��u�5�g�o�F�F�5�g�>�>�!�-�/�/�*�#*���'�!�!��A��'�'��T�7�C�@�@�@���G�#�#��A��'�'��T�7�C�@�@�@��A�
����D����@��4�4�S�$��5>�@�@�@��A�
���
�D�,�y�8�
����0���	
���d�H�e�4�4�4��8�U�+�+�+s
�(AD/�/8E)c��	|j�|jd��\}}||z||zf|j|j<|xj|z
c_|xj|z
c_dS)Nr�)r~r4r.r}r|)rr_rd�t�f2�t2s      r/�__record_outcomezDocTestRunner.__record_outcome�sc��	���"�"�4�9�e�4�4���B�$%�b�D�!�B�$�<��
�d�i� ��
�
���
�
��
�
�a��
�
�
�
r0z.<doctest (?P<name>.+)\[(?P<examplenum>\d+)\]>$c�F�|j�|��}|rp|�d��|jjkrM|jjt
|�d����}|j�d���S|�	||��S)Nr.r�T��keepends)
�%_DocTestRunner__LINECACHE_FILENAME_RErr�r_r.r��intr��
splitlines�save_linecache_getlines)rr`�module_globalsrr�s     r/�__patched_linecache_getlinesz*DocTestRunner.__patched_linecache_getlines�s����(�.�.�x�8�8���	J�������D�I�N�2�2��i�(��Q�W�W�\�-B�-B�)C�)C�D�G��>�,�,�d�,�;�;�;��/�/��.�I�I�Ir0Tc�"�	�
�	||_|�t|j��}tj�
|�/�
j�	�	��	���dkr�
j}n�	�
fd�}|jt_tj	��}tj}t�
��|_
|j
���|j
jt_tj|_|jt_tj}tjt_	|�|||���
t_|t_tj|��|jt_|t_|r%|j���ddl}d|_SS#�
t_|t_tj|��|jt_|t_|r$|j���ddl}d|_wxYw)N�utf-8c�z��t|��d�����}��|��dS)N�backslashreplace)rC�encode�write)rkrXr�s ��r/r�zDocTestRunner.run.<locals>.out�s;����A�H�H�X�/A�B�B�H�M�M�A��%�%�a�(�(�(�(�(r0r#)r_r;r7rGr�rX�lowerr�r�gettracer�r�r�r��resetr=r>r��*_DocTestRunner__patched_linecache_getlines�displayhook�__displayhook__�_DocTestRunner__run�settrace�clear�builtins�_)rr_r�r��clear_globs�
save_trace�save_set_trace�save_displayhookr�rXr�s         @@r/�runzDocTestRunner.run�s�����	�&��	���0���<�<�L��j���;�"�+�H���8�>�>�#3�#3�w�#>�#>�!�'���)�)�)�)�)�)��]��
��\�^�^�
����-�k�:�:��
��
�������
�/��
�(1�'9��$�!�>�	���?���-���	"��:�:�d�L�#�6�6�$�C�J�*�C�M��L��$�$�$�!%�!=�I��.�C�O��
"��
� � �"�"�"�����!��
�
�
"��%�C�J�*�C�M��L��$�$�$�!%�!=�I��.�C�O��
"��
� � �"�"�"�����!��
�!�!�!�!s
�F�A1Hc��	|�|j}g}g}g}dx}}|j���D]c}|\}\}	}
||
z
}||	z
}|
dkr|�|���0|	dkr|�||
f���N|�|���d|r�|rFt	t|��d��|���|D]}t	d|���|rMt	t|��d��|���|D]\}}t	d||fz���|ret	|j��t	t|��d��|���|D]\}\}	}
t	d|	|
|fz���|r9t	|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.)	r1r~rZr�rXr,rBr�r')
rr4�notests�passed�failed�totalt�totalfrr.rdr��thingr�s
             r/�	summarizezDocTestRunner.summarize�sb��		��?��m�G�������������$�$�&�&�
	!�
	!�A��L�D�&�1�a��a�K�F��a�K�F��A�v�v����t�$�$�$�$��a����
�
��a�y�*�*�*�*��
�
�a� � � � ��
	?��
(��c�'�l�l�$9�:�:�:�������$�(�(�E��%��'�'�'�'��
?��c�&�k�k�#<�=�=�=����
�
�
�$*�?�?�L�E�5��,��u�~�=�>�>�>�>��	;��$�,�����#�f�+�+�4�5�5�5��K�K�M�M�M�!'�
;�
;�
��v��1��)�Q��5�M�9�:�:�:�:��	D��&�*�c�$�-�&8�&8�(�C�C�C��&�6�/�<���C�C�C��	"��%�v�{�;�;�;�;�
�	"��.�!�!�!��6�6�*�*�*r0c��|j}|j���D](\}\}}||vr||\}}||z}||z}||f||<�)dSr�)r~rZ)rr��dr.rdr�r�r�s        r/�mergezDocTestRunner.merge7sq���M��!�N�0�0�2�2�		�		�L�D�&�1�a��q�y�y�
�4����B���F����F����d�A�d�G�G�		�		r0)NNr#r��NNT)r?r�r�r�r�r�r�r�r�r�r�r�rir*r�r�r�r�r�r�r0r/rr{s������6�r�G�$�$�$�$�H+�+�+����M�M�M�M�M�M����(L,�L,�L,�\���)�b�j�*F�G�G��J�J�J�J�D"�D"�D"�D"�R4+�4+�4+�4+�r����r0rc�(�eZdZ	d�Zd�Zd�Zd�ZdS)rc�L�	t|�dd��d��S)N�ASCIIr�)rCr�)rrks  r/�_toAsciizOutputChecker._toAsciiLs(��	��1�8�8�G�%7�8�8�'�B�B�Br0c�P�	|�|��}|�|��}||krdS|tzs||fdkrdS||fdkrdS|tzsNtjdtjt��zd|��}tjdd|��}||krdS|tzrVd�|�	����}d�|�	����}||krdS|tzrt||��rdSdS)	NT)zTrue
z1
)zFalse
z0
z(?m)^%s\s*?$r�z(?m)^[^\S\n]+$rhF)r�rrrirjri�BLANKLINE_MARKERrr�r�rr��rr�r�rzs    r/r�zOutputChecker.check_outputRsN��	��m�m�C� � ���}�}�T�"�"���$�;�;��4��4�4�	��D�z�.�.�.��t��D�z�/�/�/��t��3�3�	��6�/�B�I�6F�,G�,G�G��d�$�$�D��&�*�B��4�4�C��d�{�{��t�
�-�-�	��(�(�3�9�9�;�;�'�'�C��8�8�D�J�J�L�L�)�)�D��d�{�{��t���!�	��t�S�)�)�
��t��ur0c��|ttztzzsdS|tzrdS|�d��dko|�d��dkS)NFTr}r<)r
rrr�r�s    r/�_do_a_fancy_diffzOutputChecker._do_a_fancy_diff�si���l�*�+�*�+�,�	��5���%�	��4��z�z�$���!�#�;��	�	�$���!�(;�;r0c�\�	|j}|tzstjdt|��}|�|||���r|�d���}|�d���}|tzr1tj	||d���}t|��dd�}d}n�|tzr1tj||d���}t|��dd�}d}nN|tzrDtjtj���}	t|	�||����}d	}d
|zt#d�|����zS|r$|r"dt#|���d
t#|����S|rdt#|��zS|rdt#|��zSdS)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�rzr�r�	got_lines�diff�kind�engines
          r/r�zOutputChecker.output_difference�s���	��|���3�3�	C��&�*�,<�c�B�B�C�� � ��s�K�8�8�	I����$��7�7�J������5�5�I��\�)�

,��+�J�	�Q�G�G�G���D�z�z�!�"�"�~��<����|�+�	
,��+�J�	�Q�G�G�G���D�z�z�!�"�"�~��F����|�+�
,� ���1J�K�K�K���F�N�N�:�y�A�A�B�B��5��)�4�/�'�"�'�'�$�-�-�2H�2H�H�H��	5�C�	5�	5�.5�d�m�m�m�m�W�S�\�\�\�J�J�
�	5�/�'�$�-�-�?�?�
�	5�/�'�#�,�,�>�>�4�4r0N)r?r�r�r�r�r�r�r�r0r/rrDsY�������C�C�C�<�<�<�~<�<�<�.,5�,5�,5�,5�,5r0rc��eZdZ	d�Zd�ZdS)rc�0�||_||_||_dSr�)r_r�r�)rr_r�r�s    r/r�zDocTestFailure.__init__�s����	��������r0c�*�t|j��Sr��rCr_r�s r/�__str__zDocTestFailure.__str__�����4�9�~�~�r0N�r?r�r�r�r�r�r0r/rr�s7������	����
����r0rc��eZdZ	d�Zd�ZdS)rc�0�||_||_||_dSr�)r_r�rs)rr_r�rss    r/r�zUnexpectedException.__init__�s����	���� ��
�
�
r0c�*�t|j��Sr�r�r�s r/r�zUnexpectedException.__str__�r�r0Nr�r�r0r/rr�s7������	�!�!�!�
����r0rc�$�eZdZ	dd�Zd�Zd�ZdS)rNTc�x�t�||||d��}|r|j���|S)NF)rr�r7r�)rr_r�r�r��rs      r/r�zDebugRunner.runWs>�����d�D�,��U�C�C���	��J�������r0c�$�t|||���r�)rr�s     r/r�z'DebugRunner.report_unexpected_exception]s��!�$���:�:�:r0c�$�t|||���r�)rr�s     r/r�zDebugRunner.report_failure`s���T�7�C�0�0�0r0r�)r?r�r�r�r�r�r�r0r/rr�sM������X�t����;�;�;�1�1�1�1�1r0rTFc	��	|�tj�d��}tj|��std|�����|�|j}t|���}	|rt||���}
nt||���}
|	�
||||���D]}|
�|���|r|
���t�|
a
nt�|
��t|
j|
j��S)Nr�ztestmod: module required; )r7�r4rz�r7rD)rGrHr4r@rArKr?rrrr�r�r��masterr�r'r}r|)rr.r7r4�reportrzrD�raise_on_errorr7�finder�runnerr_s            r/rrls!��>�D	�y�
�K�O�O�J�'�'����A���?��i�!�!�=�>�>�>��|��z����
7�
7�
7�F��I��W�+�F�F�F����w�K�H�H�H�����A�t�5�Z��H�H�����
�
�4�����
��������
�~�������V�����v����5�5�5r0c�Z�	|r|std���t||||pd��\}}|�tj�|��}|�i}n|���}|�|�|��d|vrd|d<|	rt||���}
nt||���}
|
�	||||d��}|
�
|��|r|
���t�|
ant�
|
��t|
j|
j��S)N�8Package may only be specified for module-relative paths.r�r?r�rr#)r�rer�r��basenamer�r@rrrr�r�rr�r'r}r|)r`rbr.rar7r4r	rzrDr
r5rX�textrr_s               r/rr�sb��K�\�,��,��+�,�,�	,�$�H�g��$,�$7��9�9�N�D�(��|��w����)�)��
�}�����
�
������
���Z� � � �����&��j���I��W�+�F�F�F����w�K�H�H�H�����d�E�4��1�=�=�D�
�J�J�t����
��������
�~�������V�����v����5�5�5r0�NoNamec��	t|d���}t||���}|�|||���D]}|�||����dS)NF)r4r6r)r7)r�)rrr�r�)	rdr7r4r.r�rzrrr_s	         r/rrOsq��� �7�E�
:�
:�
:�F�
�7��
D�
D�
D�F����A�t�5��1�1�4�4���
�
�4�l�
�3�3�3�3�4�4r0c�V�	|tz|krtd|���t}|a|S)NzOnly reporting flags allowed)rr��_unittest_reportflags)r8�olds  r/rrls:���8	���E�)�)��7��?�?�?�
�C�!���Jr0c�d�eZdZ		dd�Zd�Zd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Ze
jZd
�ZdS)�DocTestCaser#Nc��tj�|��||_||_||_||_||_dSr�)�unittest�TestCaser��_dt_optionflags�_dt_checker�_dt_test�	_dt_setUp�_dt_tearDown)rr_rz�setUp�tearDownr�s      r/r�zDocTestCase.__init__�sG��	��"�"�4�(�(�(�*���"�����
����$����r0c��|j}|j���|_|j�|�|��dSdSr�)rr7r��	_dt_globsr�rr_s  r/r zDocTestCase.setUp�sD���}������*�*����>�%��N�N�4� � � � � �&�%r0c��|j}|j�|�|��|j���|j�|j��dSr�)rrr7r�r@r#r$s  r/r!zDocTestCase.tearDown�sZ���}����(����d�#�#�#�	
�
�������
���$�.�)�)�)�)�)r0c��|j}tj}t��}|j}|t
zs
|tz}t||jd���}	d|_	|�
||jd���\}}|t_n#|t_wxYw|r:|�|�
|��������dS)NF�rzr�r4zF----------------------------------------------------------------------)r�r�)rrGr�r$rrrrrr�r�r��failureException�format_failurerr)rr_r�newrzrr}r|s        r/�runTestzDocTestCase.runTest�s����}���j���j�j���*���o�-�	1�
�0�0�K��;�'+�'7��H�H�H��	�#�F�N�$�j�j��#�)��)�8�8�O�H�e��C�J�J���C�J������	M��'�'��(;�(;�C�L�L�N�N�(K�(K�L�L�L�	M�	Ms�'B	�	Bc
���|j}|j�d}n
d|jz}d�|j�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�r`)r�errr_r��lnames     r/r)zDocTestCase.format_failure�s|���}���;��*�F�F��D�K�'�F���������-�-�b�c�c�2�3�3����9�9�9�d�m�m�m�V�V�V�U�U�U�C�C�A�	r0c���	|���t|j|jd���}|�|jd���|���dS)NFr')r�)r rrrr�rr!)rrs  r/r"zDocTestCase.debug�sd��?	�B	
�
�
������)=�%)�%5�u�F�F�F���
�
�4�=�e�
�4�4�4��
�
�����r0c��|jjSr��rr.r�s r/r�zDocTestCase.id	s
���}�!�!r0c���t|��t|��urtS|j|jko?|j|jko/|j|jko|j|jko|j|jkSr�)r�r�rrrrrr�s  r/r�zDocTestCase.__eq__	s~����:�:�T�%�[�[�(�(�!�!��}���.�5��#�u�'<�<�5��~���0�5�� �E�$6�6�5���5�#4�4�		5r0c�P�t|j|j|j|jf��Sr�)r�rrrrr�s r/r�zDocTestCase.__hash__&	s-���T�)�4�>�4�;L��%�'�(�(�	(r0c��|jj�d��}|d�dd�|dd����d�S)Nr�r�r��))rr.r�r�)rr.s  r/r�zDocTestCase.__repr__*	sG���}�!�'�'��,�,�� ��H�H�H�c�h�h�t�C�R�C�y�&9�&9�&9�&9�:�:r0c� �d|jjzS)Nz	Doctest: r3r�s r/�shortDescriptionzDocTestCase.shortDescription0	s���T�]�/�/�/r0)r#NNN)r?r�r�r�r r!r+r)r"r�r�r�r�rNr�r9r�r0r/rr�s�������AE��%�%�%�%�!�!�!�*�*�*�M�M�M�0
�
�
�F�F�F�P"�"�"�5�5�5�(�(�(�;�;�;��n�G�0�0�0�0�0r0rc�*�eZdZd�Zd�Zd�Zd�ZeZdS)�SkipDocTestCasec�J�||_t�|d��dSr�)rLrr�)rrLs  r/r�zSkipDocTestCase.__init__4	s%��������T�4�(�(�(�(�(r0c�0�|�d��dS)Nz-DocTestSuite will not work with -O2 and above)�skipTestr�s r/r zSkipDocTestCase.setUp8	s���
�
�E�F�F�F�F�Fr0c��dSr�r�r�s r/�	test_skipzSkipDocTestCase.test_skip;	����r0c� �d|jjzS)NzSkipping tests from %s)rLr?r�s r/r9z SkipDocTestCase.shortDescription>	s��'�$�+�*>�>�>r0N)r?r�r�r�r r@r9r�r�r0r/r;r;3	sT������)�)�)�G�G�G�
�
�
�?�?�?��G�G�Gr0r;c��eZdZd�ZdS)�
_DocTestSuitec��dSr�r�)rr�s  r/�_removeTestAtIndexz _DocTestSuite._removeTestAtIndexF	rAr0N)r?r�r�rFr�r0r/rDrDD	s#������
�
�
�
�
r0rDc�"�	|�t��}t|��}|�|||���}|sGtjjdkr2t
��}|�t|����|S|�	��t
��}|D]h}t|j��dkr�|js&|j
}|dd�dkr
|dd�}||_|�t|fi|�����i|S)Nrr<r#rcrdr�)rrNr�rGr8�optimizerD�addTestr;rBr,r�r`r�r)	rLr7rD�test_finderr�rE�suiter_r`s	         r/rrJ	s��!�F��#�o�o��
�v�
&�
&�F����V�5�Z��H�H�E���S�Y�'�!�+�+�����
�
�
�o�f�-�-�.�.�.���	�J�J�L�L�L��O�O�E��4�4���t�}����"�"���}�	%���H�����}��&�&�#�C�R�C�=��$�D�M�
�
�
�k�$�2�2�'�2�2�3�3�3�3��Lr0c� �eZdZd�Zd�Zd�ZdS)�DocFileCasec�f�d�|jj�d����S)Nr�r�)r�rr.r�r�s r/r�zDocFileCase.id�	s'���x�x��
�*�0�0��5�5�6�6�6r0c��|jjSr�)rr`r�s r/r�zDocFileCase.__repr__�	s
���}�%�%r0c�@�d|jj�d|jj�d|��S)Nr-r.z", line 0

)rr.r`)rr/s  r/r)zDocFileCase.format_failure�	s.����=�%�%�%�t�}�'=�'=�'=�s�s�D�	r0N)r?r�r�r�r�r)r�r0r/rMrM�	sA������7�7�7�&�&�&�����r0rMc�$�|�i}n|���}|r|std���t||||pd��\}}d|vr||d<tj�|��}|�||||d��}	t|	fi|��S)Nrr�r�r#)r�r�rer�r�rrrM)
r�rbrar7r5rXr��docr.r_s
          r/�DocFileTestrS�	s���
�}�����
�
�����,��,��+�,�,�	,��t�W�o�'�2�7�4�4�I�C������ ��j���7���D�!�!�D����c�5�$��a�8�8�D��t�'�'�w�'�'�'r0c���	t��}|�dd��r%t|�d����|d<|D]"}|�t	|fi|�����#|S)NrbTra)rDr4rNrIrS)�paths�kwrKr�s    r/rr�	s���6�n
�O�O�E�

�v�v���&�&�=�)�"�&�&��*;�*;�<�<��9�
��/�/��
�
�
�k�$�-�-�"�-�-�.�.�.�.��Lr0c��	g}t���|��D]�}t|t��rk|�|jdd���|j}|r?|�d��|d�|�d��dd�D��z
}��|d�|�d��dd�D��z
}��|r.|ddkr"|���|r|ddk�"|r/|ddkr#|�d��|r|ddk�#d�	|��dzS)Nr�z# Expected:c��g|]}d|z��S)z## r��r�r�s  r/r�z(script_from_examples.<locals>.<listcomp>=
s��B�B�B�q�5��7�B�B�Br0r}c�,�g|]}t|����Sr�)r�rYs  r/r�z(script_from_examples.<locals>.<listcomp>@
s0��8�8�8��%�Q�'�'�8�8�8r0r�r#)
rrrBrr�r�r�r��popr�)rkr��piecer�s    r/rr�	s���8�r�F����&�&�q�)�)�8�8���e�W�%�%�	8��M�M�%�,�s��s�+�,�,�,��:�D��
C��
�
�m�,�,�,��B�B�D�J�J�t�,<�,<�S�b�S�,A�B�B�B�B���
�8�8� %���D� 1� 1�#�2�#� 6�8�8�8�
8�F�F���V�B�Z�3�&�&��
�
������V�B�Z�3�&�&�
��V�A�Y�#�%�%��
�
�1�
�
�
���V�A�Y�#�%�%��9�9�V���t�#�#r0c����	t|��}t���|��}�fd�|D��}|st�d���|d}t	|j��}|S)Nc�*��g|]}|j�k�
|��Sr�r-)r�r�r.s  �r/r�ztestsource.<locals>.<listcomp>U
s ���/�/�/�!���$���A���r0znot found in testsr#)rNrr�r�rr�)rLr.rEr_�testsrcs `   r/r r L
s}�����v�
&�
&�F��O�O� � ��(�(�E�/�/�/�/�u�/�/�/�D��5���3�4�4�4���7�D�"�4�>�2�2�G��Nr0c�H�	t|��}t|||��dSr�)r�debug_script)�src�pmr7r_s    r/r!r!\
s*��>�"�3�'�'�G���"�e�$�$�$�$�$r0c��	ddl}|r|���}ni}|r�	t|||��dS#tt	j��d��|jd���}|���|�dt	j��d��YdSxYw|jd����	d|z||��dS)Nr#r)T)r�r<zexec(%r))
r�r�r�rXrGrsr�r��interactionr�)rbrcr7r��ps     r/raraa
s���=��J�J�J����
�
�������	�	C�	3���e�U�#�#�#�#�#��	3��#�,�.�.��#�$�$�$�����&�&�&�A�
�G�G�I�I�I�
�M�M�$�����q� 1�2�2�2�2�2�2�����������"�"�:��#3�U�E�B�B�B�B�Bs
�5�A:B2c�r�	t|��}t||��}t|||j��dSr�)rNr rar?)rLr.rcr_s    r/r"r"u
s?����v�
&�
&�F����&�&�G���"�f�o�.�.�.�.�.r0c�"�eZdZ	d�Zd�Zd�ZdS)�
_TestClassc��	||_dSr��ra)rras  r/r�z_TestClass.__init__�
s��	�����r0c�&�	|jdz|_|S)Nr<rkr�s r/�squarez_TestClass.square�
s��	��8�q�=����r0c��	|jSr�rkr�s r/r4z_TestClass.get�
s��	��x�r0N)r?r�r�r�rmr4r�r0r/riri�
sF�����������������r0riz�
                      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]
            )rir�zbool-int equivalencezblank lines�ellipsiszwhitespace normalizationc�4�ddl}|�d���}|�ddddd�	��|�d
ddt���gd
���|�dddd���|�ddd���|���}|j}|j}d}|jD]}|t|z}�|j	r
|tz}|D]�}|�d��r|tj
�|��\}}tj
�d|��t#|dd���}	tj
d=t%|	||���\}
}nt'|d||���\}
}|
rdS��dS)Nr#zdoctest runner)�descriptionrxz	--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)rs�choicesrtruz-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))rsrurorz file containing the tests to run)�nargsruz.py���r)rbr4rzr))�argparse�ArgumentParser�add_argumentr*�keys�
parse_argsror4r�	fail_fastrr~r�r�r�rG�insertrDrr)ryr5r��	testfilesr4r�rr`�dirnamerr}r�s            r/�_testr��
s	���O�O�O�
�
$�
$�1A�
$�
B�
B�F�
����k�,��F��H�H�H�
����j�� 3� 8� 8� :� :�B�E��G�G�G�
����m�L�F��H�H�H�����c�?��A�A�A������D��	�I��l�G��G��+�/�/���&�v�.�.����~���9����������U�#�#�	K�!#��
�
�h� 7� 7��G�X��H�O�O�A�w�'�'�'��8�C�R�C�=�)�)�A�����!�!�W�'�J�J�J�K�H�a�a�"�8�U�-4�'�K�K�K�K�H�a��	��1�1�	��1r0r�)r<)rf)	NNNNTr#NFF)FrNr#ru)FN)F)S�
__docformat__�__all__r2r�r@r=r�r�rirGrpr�ior$r%�collectionsr&r'r*rrrrrrrr	r
rrr
rrr�r�r;rNrSrermrxrzr�r�r�r�r�rYrrrrrr�	Exceptionrrrrrrrrrrrr;�	TestSuiterDrrMrSrrr r!rar"rirWr�r?�exitr�r0r/�<module>r�sS��%�N&�
�+�+�+��Z����������������	�	�	�	�
�
�
�
�	�	�	�	�
�
�
�
���������2�2�2�2�2�2�2�2�"�"�"�"�"�"��j��(:�;�;��.��O�O�O�-�,�-E�F�F��+�+�,C�D�D��*�*�+A�B�B����z�*�*����6�"�"��-�-�.G�H�H��*�)�*�(�)����	�
,�,��#�"�>�2�2��"�"�>�2�2��"�"�>�2�2��/�/�0K�L�L�����,�,�	��� �� �-�-��	��!����&
�
�
�>�>�>�>�&D�D�D�"�"�"�$/�/�/�/�	�	�	� � � � � �� � � �/�/�/�b������4"%�"%�"%�"%�"%�C�G�"%�"%�"%�J ,� ,� ,�\B$�B$�B$�B$�B$�B$�B$�B$�HGD�GD�GD�GD�GD�GD�GD�GD�Zd;�d;�d;�d;�d;�d;�d;�d;�VD�D�D�D�D�D�D�D�T
G�G�G�G�G�G�G�G�RP5�P5�P5�P5�P5�P5�P5�P5�d�����Y����&�����)����&e1�e1�e1�e1�e1�-�e1�e1�e1�\
��37�37�05�f6�f6�f6�f6�P(,�$����d���U�=�=�?�?��y6�y6�y6�y6�v:B�:;�4�4�4�4�6��!�!�!�Ha0�a0�a0�a0�a0�(�#�a0�a0�a0�F�����k����"
�
�
�
�
�H�&�
�
�
�>�>�>�>�@�����+����'+�D��=�=�?�?��(�(�(�(�4C�C�C�RP$�P$�P$�d��� %�%�%�%�
C�C�C�C�(	/�	/�	/�	/�*�*�*�*�*�*�*�*�X%��%(� ��)�Q0
�0
��f*
�*
�*
�Z�z����C�H�U�U�W�W�������r0

Zerion Mini Shell 1.0