Your IP : 216.73.216.85


Current Path : /opt/alt/python38/lib64/python3.8/test/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/test/__pycache__/test_pydoc.cpython-38.pyc

U

i�f���@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlm Z ddlm!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)ddlm*Z*Gdd�d�Z+ej,j-�r2d	Z.nd
Z.d�/�Z0e1dd
�e.D��Z2d�/�Z3e1dd
�e.D��Z4d�5dej6�Z7dZ8d�/�Z9d�/�Z:d�/�Z;d�/�Z<d�/�Z=dd�Z>dd�Z?dd�Z@dd�ZAd d!�ZBGd"d#�d#ejC�ZDGd$d%�d%ejC�ZEGd&d'�d'eD�ZFGd(d)�d)ejC�ZGGd*d+�d+ejC�ZHGd,d-�d-eD�ZIGd.d/�d/ejC�ZJGd0d1�d1ejC�ZKGd2d3�d3ejC�ZLe$d4d5��ZMeNd6k�r�eM�dS)7�N)�StringIO)�
namedtuple)�assert_python_ok)	�TESTFN�rmtree�
reap_children�reap_threads�captured_output�captured_stdout�captured_stderr�unlink�requires_docstrings)�	pydoc_modc@seZdZdZdS)�nonasciiuЦе не латиницяN��__name__�
__module__�__qualname__�__doc__�rr�4/opt/alt/python38/lib64/python3.8/test/test_pydoc.pyr#sr)�.dictionary for instance variables (if defined)�2list of weak references to the object (if defined)rr)�rrraq
NAME
    test.pydoc_mod - This is a test module for test_pydoc
%s
CLASSES
    builtins.object
        A
        B
        C
    
    class A(builtins.object)
     |  Hello and goodbye
     |  
     |  Methods defined here:
     |  
     |  __init__()
     |      Wow, I have no function!
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__%s
     |  
     |  __weakref__%s
    
    class B(builtins.object)
     |  Data descriptors defined here:
     |  
     |  __dict__%s
     |  
     |  __weakref__%s
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  NO_MEANING = 'eggs'
     |  
     |  __annotations__ = {'NO_MEANING': <class 'str'>}
    
    class C(builtins.object)
     |  Methods defined here:
     |  
     |  get_answer(self)
     |      Return say_no()
     |  
     |  is_it_true(self)
     |      Return self.get_answer()
     |  
     |  say_no(self)
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)

FUNCTIONS
    doc_func()
        This function solves all of the world's problems:
        hunger
        lack of Python
        war
    
    nodoc_func()

DATA
    __xyz__ = 'X, Y and Z'

VERSION
    1.2.3.4

AUTHOR
    Benjamin Peterson

CREDITS
    Nobody

FILE
    %s
ccs|]}|rd|ndVqdS)z
     |      rNr��.0�srrr�	<genexpr>�s�ra*
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="test.html"><font color="#ffffff">test</font></a>.pydoc_mod</strong></big></big> (version 1.2.3.4)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:%s">%s</a>%s</font></td></tr></table>
    <p><tt>This&nbsp;is&nbsp;a&nbsp;test&nbsp;module&nbsp;for&nbsp;test_pydoc</tt></p>
<p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%%"><dl>
<dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="test.pydoc_mod.html#A">A</a>
</font></dt><dt><font face="helvetica, arial"><a href="test.pydoc_mod.html#B">B</a>
</font></dt><dt><font face="helvetica, arial"><a href="test.pydoc_mod.html#C">C</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="A">class <strong>A</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Hello&nbsp;and&nbsp;goodbye<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%%">Methods defined here:<br>
<dl><dt><a name="A-__init__"><strong>__init__</strong></a>()</dt><dd><tt>Wow,&nbsp;I&nbsp;have&nbsp;no&nbsp;function!</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>%s</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>%s</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="B">class <strong>B</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%%">Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>%s</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>%s</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>NO_MEANING</strong> = 'eggs'</dl>

<dl><dt><strong>__annotations__</strong> = {'NO_MEANING': &lt;class 'str'&gt;}</dl>

</td></tr></table> <p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="C">class <strong>C</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%%">Methods defined here:<br>
<dl><dt><a name="C-get_answer"><strong>get_answer</strong></a>(self)</dt><dd><tt>Return&nbsp;<a href="#C-say_no">say_no</a>()</tt></dd></dl>

<dl><dt><a name="C-is_it_true"><strong>is_it_true</strong></a>(self)</dt><dd><tt>Return&nbsp;self.<a href="#C-get_answer">get_answer</a>()</tt></dd></dl>

<dl><dt><a name="C-say_no"><strong>say_no</strong></a>(self)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%%"><dl><dt><a name="-doc_func"><strong>doc_func</strong></a>()</dt><dd><tt>This&nbsp;function&nbsp;solves&nbsp;all&nbsp;of&nbsp;the&nbsp;world's&nbsp;problems:<br>
hunger<br>
lack&nbsp;of&nbsp;Python<br>
war</tt></dd></dl>
 <dl><dt><a name="-nodoc_func"><strong>nodoc_func</strong></a>()</dt></dl>
</td></tr></table><p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%%"><strong>__xyz__</strong> = 'X, Y and Z'</td></tr></table><p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
    
<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%%">Benjamin&nbsp;Peterson</td></tr></table><p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Credits</strong></big></font></td></tr>
    
<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%%">Nobody</td></tr></table>
ccs|]}|�dd�VqdS)� z&nbsp;N)�replacerrrrrs�z~No Python documentation found for %r.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.�
z7problem in %s - ModuleNotFoundError: No module named %ra/
Help on class DA in module %s:

class DA(builtins.object)
 |  Data descriptors defined here:
 |  
 |  __dict__%s
 |  
 |  __weakref__%s
 |  
 |  ham
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes inherited from Meta:
 |  
 |  ham = 'spam'
z�
Help on class Class in module %s:

class Class(builtins.object)
 |  Data and other attributes inherited from Meta:
 |  
 |  LIFE = 42
z�
Help on class Class1 in module %s:

class Class1(builtins.object)
 |  Data and other attributes inherited from Meta1:
 |  
 |  one = 1
a
Help on class Class2 in module %s:

class Class2(Class1)
 |  Method resolution order:
 |      Class2
 |      Class1
 |      builtins.object
 |  
 |  Data and other attributes inherited from Meta1:
 |  
 |  one = 1
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes inherited from Meta3:
 |  
 |  three = 3
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes inherited from Meta2:
 |  
 |  two = 2
z�
Help on class C in module %s:

class C(builtins.object)
 |  Data and other attributes defined here:
 |  
 |  here = 'present!'
cOs,||f}tdtjf|�|�\}}}|��S)zW
    Runs pydoc on the specified module. Returns the stripped
    output of pydoc.
    z-B)r�pydoc�__file__�strip)Zmodule_name�args�envZrc�out�errrrr�	run_pydocRs
r(cCs<t��}|�|�}|�t�pd}|r0d|d}|��|fS)z&Returns pydoc generated output as htmlrz
<br><a href="z">Module Docs</a>)r!�HTMLDoc�	docmodule�	getdoclocrr#)�module�doc�output�locrrr�get_pydoc_html\s
r0cCs:tjj}tjj}|||t���}t��}|j||d�}|S)z,Returns a documentation web link of a module)�basedir)�os�path�abspath�dirnamer"r!�TextDocr+)r,r4r5r1r-r/rrr�get_pydoc_linkesr7cCsRt��}|�t�pd}|r&d|d}|�|�}t�d�}|�d|�}|��|fS)z&Returns pydoc generated output as textrz
MODULE DOCS
    r �.)	r!r6r+rr*�re�compile�subr#)r,r-r/r.Zpattrrr�get_pydoc_textns

r<cCs4|�d�\}}}|�d�\}}}|�d�\}}}|S)Nz</head>z<title>z</title>)�	partition)�text�header�_�titlerrr�get_html_title|srBc@s.eZdZddd�Zejd	dd��Zdd�ZdS)
�
PydocBaseTestNcs&|ptj�t�g�d��fdd�	}|S)zi
        A version of pkgutil.walk_packages() that will restrict itself to
        a given path.
        Nrcs�|p�||�S�Nr)r3�prefix�onerror�Zdefault_path�
walk_packagesrr�wrapper�sz8PydocBaseTest._restricted_walk_packages.<locals>.wrapper)NrN)r2r3r5r")�selfrHr3rIrrGr�_restricted_walk_packages�sz'PydocBaseTest._restricted_walk_packagesccs,tj}|�||�t_z
dVW5|t_XdSrD)�pkgutilrHrK)rJr3rHrrr�restrict_walk_packages�s�
z$PydocBaseTest.restrict_walk_packagescCs&t�|d�}t|�}|�|||�|S)Nz	text/html)r!�_url_handlerrB�assertEqual)rJ�urlZexpected_titler>�resultrrr�call_url_handler�szPydocBaseTest.call_url_handler)N)N)rrrrK�
contextlib�contextmanagerrMrRrrrrrC�s

	rCc@s�eZdZdZe�ejjdkd�e�e	ed�o2e�
�d�edd����Ze�ejjdkd�e�e	ed�ole�
�d�edd	����Z
d
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Ze�ejjdkd�dd��Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Ze�ejjdkd�e�e	ed��o,e�
�d�ed'd(����Zd)d*�Zd+d,�Zd-d.�Ze�ejjdkd�d/d0��Z d1d2�Z!d3d4�Z"d5d6�Z#d7d8�Z$d9d:�Z%d;d<�Z&dS)=�PydocDocTestN��)Docstrings are omitted with -O2 and above�gettrace�1trace function introduces __locals__ unexpectedlycCsDtt�\}}t�t�}tj�|�}t|||ft}|�	||�dSrD)
r0r�inspect�
getabsfile�urllib�parseZquote�expected_html_pattern�expected_html_data_docstringsrO)rJrQ�doc_locZmod_fileZmod_urlZ
expected_htmlrrr�
test_html_doc�s
��zPydocDocTest.test_html_doccCs6tt�\}}t|ftt�t�f}|�||�dSrD)r<r�expected_text_pattern�expected_text_data_docstringsrZr[rO)rJrQr`�
expected_textrrr�
test_text_doc�s�
��zPydocDocTest.test_text_doccCs4ddl}Gdd�d|j�}t�|�}|�d|�dS)Nrc@seZdZdZdZdS)zIPydocDocTest.test_text_enum_member_with_value_zero.<locals>.BinaryIntegerr�N)rrrZzero�onerrrr�
BinaryInteger�srhz<BinaryInteger.zero: 0>)�enum�IntEnumr!�
render_doc�assertIn)rJrirhr-rrr�%test_text_enum_member_with_value_zero�s
z2PydocDocTest.test_text_enum_member_with_value_zerocCsttjj�}|�d|�dS)Nzxml.etree.elementtree)r7�xml�etreeZElementTreerl)rJZdoc_linkrrr�,test_mixed_case_module_names_are_lower_cased�sz9PydocDocTest.test_mixed_case_module_names_are_lower_casedcCs ttj�\}}|�|dd�dS)Nrz'MODULE DOCS incorrectly includes a link)r<rnrorO)rJrQr`rrr�test_issue8225�szPydocDocTest.test_issue8225cCs&tj}zdt_t��W5|t_XdSrD)�sys�stdinr!�getpager)rJZprevious_stdinrrr�test_getpager_with_stdin_none�s
z*PydocDocTest.test_getpager_with_stdin_nonecCsLGdd�d�}Gdd�d�}t�|��}t�|��}|�|�dd�|�dS)Nc@seZdZdZdS)z)PydocDocTest.test_non_str_name.<locals>.A�*N�rrrrrrr�A�srxc@seZdZdS)z)PydocDocTest.test_non_str_name.<locals>.BNrwrrrr�B�sry)r!rkrOr)rJrxryZadocZbdocrrr�test_non_str_name�s
zPydocDocTest.test_non_str_namecCs,d}tt|�d�}t|}|�||d�dS)N�test.i_am_not_here�asciiz&documentation for missing module found)�strr(�missing_patternrO�rJZmissing_modulerQ�expectedrrr�
test_not_here�s�zPydocDocTest.test_not_herez)Docstrings are omitted with -OO and abovecCs*tddd�}tj�dd�}|�||�dS)Nztest.test_pydoc.nonasciir|)ZPYTHONIOENCODING�backslashreplace)r(rr�encoderl)rJrQZencodedrrr�test_not_ascii�szPydocDocTest.test_not_asciicCs.d}tt|�d�}t|��}|�||�dS)Nz test.i_am_not_here r|)r}r(r~r#rOrrrr�test_input_strip�szPydocDocTest.test_input_stripcCsJtj}|�|d�d�|�|d�d�|�|d�d�|�|d�d�dS)Nz<function stripid at 0x88dcee4>z<function stripid>z <function stripid at 0x01F65390>Z42z<type 'exceptions.Exception'>)r!�stripidrO)rJr�rrr�test_stripid�s
�
�
�zPydocDocTest.test_stripidcCs&t��}|�t�}d}|�||�dS)a�Tests help on builtin object which have more than four child classes.

        When running help() on a builtin class which has child classes, it
        should contain a "Built-in subclasses" section and only 4 classes
        should be displayed with a hint on how many more subclasses are present.
        For example:

        >>> help(object)
        Help on class object in module builtins:

        class object
         |  The most base type
         |
         |  Built-in subclasses:
         |      async_generator
         |      BaseException
         |      builtin_function_or_method
         |      bytearray
         |      ... and 82 other subclasses
        z� |  Built-in subclasses:
 |      async_generator
 |      BaseException
 |      builtin_function_or_method
 |      bytearray
 |      ... and \d+ other subclassesN)r!r6�docclass�objectZassertRegex�rJr-r>Zsniprrr�)test_builtin_with_more_than_four_childrens
z6PydocDocTest.test_builtin_with_more_than_four_childrencCs&t��}|�t�}d}|�||�dS)a1Tests help on builtin object which have only child classes.

        When running help() on a builtin class which has child classes, it
        should contain a "Built-in subclasses" section. For example:

        >>> help(ArithmeticError)
        Help on class ArithmeticError in module builtins:

        class ArithmeticError(Exception)
         |  Base class for arithmetic errors.
         |
         ...
         |
         |  Built-in subclasses:
         |      FloatingPointError
         |      OverflowError
         |      ZeroDivisionError
        zc |  Built-in subclasses:
 |      FloatingPointError
 |      OverflowError
 |      ZeroDivisionErrorN)r!r6r��ArithmeticErrorrlr�rrr�test_builtin_with_child's
z$PydocDocTest.test_builtin_with_childcCs2t��}|�t�}d}|�||�|�d|�dS)a�Tests help on builtin classes which have grandchild classes.

        When running help() on a builtin class which has child classes, it
        should contain a "Built-in subclasses" section. However, if it also has
        grandchildren, these should not show up on the subclasses section.
        For example:

        >>> help(Exception)
        Help on class Exception in module builtins:

        class Exception(BaseException)
         |  Common base class for all non-exit exceptions.
         |
         ...
         |
         |  Built-in subclasses:
         |      ArithmeticError
         |      AssertionError
         |      AttributeError
         ...
        z^ |  Built-in subclasses:
 |      ArithmeticError
 |      AssertionError
 |      AttributeError�ZeroDivisionErrorN)r!r6r��	Exceptionrl�assertNotInr�rrr�test_builtin_with_grandchildBs

z)PydocDocTest.test_builtin_with_grandchildcCs"t��}|�t�}|�d|�dS)a�Tests help on builtin object which have no child classes.

        When running help() on a builtin class which has no child classes, it
        should not contain any "Built-in subclasses" section. For example:

        >>> help(ZeroDivisionError)

        Help on class ZeroDivisionError in module builtins:

        class ZeroDivisionError(ArithmeticError)
         |  Second argument to a division or modulo operation was zero.
         |
         |  Method resolution order:
         |      ZeroDivisionError
         |      ArithmeticError
         |      Exception
         |      BaseException
         |      object
         |
         |  Methods defined here:
         ...
        �Built-in subclassesN)r!r6r�r�r��rJr-r>rrr�test_builtin_no_childbs
z"PydocDocTest.test_builtin_no_childcCs"t��}|�t�}|�d|�dS)z�Tests help on metaclasses.

        When running help() on a metaclasses such as type, it
        should not contain any "Built-in subclasses" section.
        r�N)r!r6r��typer�r�rrr�test_builtin_on_metaclasses~s
z(PydocDocTest.test_builtin_on_metaclassesc
Cs�t}tj}dd�}d|_t�}tj|d�}tt�\}}d}d��}	t	�
|	�}	|	t}
|t_z�td��v}td��b}|�|�|�
���}
|
|ftt�t�f}|�d|�
��|�d|�
��|�||
�W5QRXW5QRXW5|t_XdS)	NcSsdd�S)NcSs|SrDr)�xrrr�<lambda>��zJPydocDocTest.test_help_output_redirect.<locals>.<lambda>.<locals>.<lambda>rrrrrr��r�z8PydocDocTest.test_help_output_redirect.<locals>.<lambda>�r.ztest.pydoc_modz9
        Help on module test.pydoc_mod in test:

        �stdout�stderrr)rbr!rt�maxDiffr�Helperr<r�lstrip�textwrap�dedentr	�help�getvaluer#rcrZr[rO)rJZold_patternZgetpager_oldZgetpager_newZbuf�helperZunusedr`r,Zhelp_headerZexpected_help_patternr.r'rQrdrrr�test_help_output_redirect�s<

�
�
��$z&PydocDocTest.test_help_output_redirectc	Csftdddg�}t��}t�|�W5QRX|��}|�d|�|�d|�|�d|�|�d|�dS)N�Person�nickname�	firstnamezAlias for field number 0zAlias for field number 1�rr
r!r�r�rl)rJr��help_io�helptextrrr�test_namedtuple_fields�sz#PydocDocTest.test_namedtuple_fieldsc	Cs^tdddgdd�}t��}t�|�W5QRX|��}|�d|�|�d|�|�d|�dS)	N�NT�abc�defT)�renameZ_1�_replace�_asdictr�)rJr�r�r�rrr�!test_namedtuple_public_underscore�sz.PydocDocTest.test_namedtuple_public_underscorec
Cs~|�tt�dD]h}ttd|d��8}|dkr>td�|�|d�td|d�td|d�W5QRXt�ti�}|�|d	�qdS)
N)z
ISO-8859-1�UTF-8�w��encodingr�z#coding: {})�fileu"""line 1: héz
line 2: hi"""uline 1: hé)	�
addCleanuprr�open�print�formatr!�synopsisrO)rJr�Zscriptr�rrr�
test_synopsis�szPydocDocTest.test_synopsiscCs.tj��d}tj}t�|�}|�||�dS)Nr)r2r�
splitlines�
__cached__r!r�rO)rJr��filenamer�rrr�test_synopsis_sourceless�s
z%PydocDocTest.test_synopsis_sourcelessc
Cs�tj���v}tj�|d�}tj�|�}t	|d��}|�
d�W5QRXt�|�t
�|i�}|�|�t
�|i�}|�|�W5QRXdS)Nzfoomod42.pyr��foo = 1)�test�support�temp_cwdr2r3�join�	importlib�util�cache_from_sourcer��write�
py_compiler:r!r��assertIsNone)rJ�test_dir�	init_pathZcached_path�fobjr�Zsynopsis_cachedrrr�"test_synopsis_sourceless_empty_doc�s

z/PydocDocTest.test_synopsis_sourceless_empty_doccCsd}|�t�|�d�dS)Nz#I Am A Doc


Here is my description)z
I Am A Docz
Here is my description)rOr!Zsplitdoc)rJZexample_stringrrr�test_splitdoc_with_description�s�z+PydocDocTest.test_splitdoc_with_descriptionc	Cs*tj���}|�t�|��W5QRXdSrD)r�r�r�ZassertFalser!�	ispackage)rJr�rrr� test_is_package_when_not_package�sz-PydocDocTest.test_is_package_when_not_packagec	CsPtj���<}tj�|d�}t|d���|�t	�
|��t�|�W5QRXdS)N�__init__.pyr�)r�r�r�r2r3r�r��close�
assertTruer!r��remove)rJr�r�rrr�test_is_package_when_is_package�s
z,PydocDocTest.test_is_package_when_is_packagecCs`Gdd�dt�}ttt��}|j|d<|d=|d=|j|d<|j|d<t�|�}|�||�dS)Nc@seZdZdd�ZdS)z/PydocDocTest.test_allmethods.<locals>.TestClasscSsdS)NTr�rJrrr�method_returning_true�szEPydocDocTest.test_allmethods.<locals>.TestClass.method_returning_trueN)rrrr�rrrr�	TestClass�sr�r�r�	__class__�__subclasshook__�__init_subclass__)	r��dict�varsr�r�r�r!Z
allmethodsZassertDictEqual)rJr�r��methodsrrr�test_allmethods�s



zPydocDocTest.test_allmethodscspGdd�d��G�fdd�d��}t�|�}t�dd|�}|�|dt�tj|t��d�}|�|d	t�dS)
Nc@s"eZdZddd�ZeZdd�ZdS)z+PydocDocTest.test_method_aliases.<locals>.ANcSsdS)z(Raise this widget in the stacking order.Nr)rJZ	aboveThisrrr�tkraisesz3PydocDocTest.test_method_aliases.<locals>.A.tkraisecSsdS)zReturn sizeNrr�rrr�a_sizesz2PydocDocTest.test_method_aliases.<locals>.A.a_size)N)rrrr�Zliftr�rrrrrxs
rxcs eZdZddd�ZeZ�jZdS)z+PydocDocTest.test_method_aliases.<locals>.BNc[sdS)z'Configure resources of an item TAGORID.Nr)rJZtagOrIdZcnf�kwrrr�
itemconfiguresz9PydocDocTest.test_method_aliases.<locals>.B.itemconfigure)N)rrrr�Z
itemconfigr�Zb_sizer�rxrrrys
ryr8ra�Python Library Documentation: class B in module %s

class B(A)
 |  Method resolution order:
 |      B
 |      A
 |      builtins.object
 |  
 |  Methods defined here:
 |  
 |  b_size = a_size(self)
 |  
 |  itemconfig = itemconfigure(self, tagOrId, cnf=None, **kw)
 |  
 |  itemconfigure(self, tagOrId, cnf=None, **kw)
 |      Configure resources of an item TAGORID.
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from A:
 |  
 |  a_size(self)
 |      Return size
 |  
 |  lift = tkraise(self, aboveThis=None)
 |  
 |  tkraise(self, aboveThis=None)
 |      Raise this widget in the stacking order.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from A:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
)ZrendereraPython Library Documentation: class B in module %s

<p>
<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="B">class <strong>B</strong></a>(A)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%%"><dl><dt>Method resolution order:</dt>
<dd>B</dd>
<dd>A</dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="B-b_size"><strong>b_size</strong></a> = <a href="#B-a_size">a_size</a>(self)</dt></dl>

<dl><dt><a name="B-itemconfig"><strong>itemconfig</strong></a> = <a href="#B-itemconfigure">itemconfigure</a>(self, tagOrId, cnf=None, **kw)</dt></dl>

<dl><dt><a name="B-itemconfigure"><strong>itemconfigure</strong></a>(self, tagOrId, cnf=None, **kw)</dt><dd><tt>Configure&nbsp;resources&nbsp;of&nbsp;an&nbsp;item&nbsp;TAGORID.</tt></dd></dl>

<hr>
Methods inherited from A:<br>
<dl><dt><a name="B-a_size"><strong>a_size</strong></a>(self)</dt><dd><tt>Return&nbsp;size</tt></dd></dl>

<dl><dt><a name="B-lift"><strong>lift</strong></a> = <a href="#B-tkraise">tkraise</a>(self, aboveThis=None)</dt></dl>

<dl><dt><a name="B-tkraise"><strong>tkraise</strong></a>(self, aboveThis=None)</dt><dd><tt>Raise&nbsp;this&nbsp;widget&nbsp;in&nbsp;the&nbsp;stacking&nbsp;order.</tt></dd></dl>

<hr>
Data descriptors inherited from A:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table>)r!rkr9r;rOrr))rJryr-rr�r�test_method_aliases
s
%�'(�z PydocDocTest.test_method_aliases)'rrrr��unittest�skipIfrr�flags�optimize�hasattrrXr
rarermrprqrurzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrU�sn��	��
�

 ��#
	�
rUc@szeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Ze	�
d
�dd��Ze	�
d
�dd��Ze	�
d�dd��Z
dd�ZdS)�PydocImportTestcCs$t�t�|_|�tt�t��dSrD)r2�mkdirrr�r�rr��invalidate_cachesr�rrr�setUprszPydocImportTest.setUpc	
Cs�d}dddd�|�dfd�|�d�|�ff}tj�t|�tjd}|D]X\}}t|d	��}|�d
�|��W5QRXt|td��	d�}t
||f}|�||�qHdS)
NZ
testmod_xyzzy)�
i_am_not_herer�)�test.i_am_not_here_eitherr�)ztest.i_am_not_here.neither_am_ir{zi_am_not_here.{}r�ztest.{}�pyr�z
import {}
)Z
PYTHONPATHr|)r�r2r3r�r�extsepr�r�r(�decode�badimport_patternrO)	rJ�modnameZ	testpairsZsourcefnZimportstringZ
expectedinmsg�frQr�rrr�test_badimportws�zPydocImportTest.test_badimportcCstj�td�}t�|�tj�|d�tjd}t|d��}|�d�W5QRX|jtgd���t	��"}t
��}t�d�W5QRXW5QRX|�
|��d�|�
|��d�t	��"}t
��}t�d�W5QRXW5QRX|�
|����d�|�
|��d�W5QRXdS)	NZ	syntaxerr�__init__r�r�zinvalid python syntax = $1
�r3Zxyzzyr)r2r3r�rr�r�r�r�rMr
rr!�aproposrOr�r#)rJ�pkgdirZ	badsyntaxr�r&r'rrr�test_apropos_with_bad_package�s 
z-PydocImportTest.test_apropos_with_bad_packagecCs�tj�td�|_t�|jd�|�tj|j�|jtgd��4t	��"}t
��}t�d�W5QRXW5QRXW5QRX|�
|��d�|�
|��d�dS)NZ
unreadablerr�ZSOMEKEYr)r2r3r�rZunreadable_dirr�r��rmdirrMr
rr!r�rOr�)rJr&r'rrr� test_apropos_with_unreadable_dir�s(z0PydocImportTest.test_apropos_with_unreadable_dirc
Cs�tj�td�}t�|�|�t|�tj�|d�}t|d��}|�d�W5QRXt	�
t�	|�j�}z^t�||t	j
@�|jtgd��"t��}t�d�W5QRXW5QRX|�d|���W5t�||�XdS)NZwalkpkgr�r�r�r�r)r2r3r�rr�r�rr�r��stat�S_IMODE�st_mode�chmod�S_IEXECrMr
r!r�rlr�)rJr�r�r�Zcurrent_moder�rrr�test_apropos_empty_doc�s
z&PydocImportTest.test_apropos_empty_doccCs�tj�td�}t�|�tj�|d�}t|ddd��}|�d�W5QRX|jtgd��ptt	j�}t	j�
dt�z@|�td	��ddl
}W5QRX|�d
d�}d}|�||�W5|t	jdd�<XW5QRXdS)
N�test_error_packager�Zwtr|r�zraise ValueError("ouch")
r�rZouchzsearch?key=test_error_package�Pydoc: Search Resultsz8<a href="test_error_package.html">test_error_package</a>)r2r3r�rr�r�r�rM�tuplerr�insertZassertRaisesRegex�
ValueErrorr	rRrl)rJr�Zinitr�Zsaved_pathsr	r>�foundrrr�test_url_search_package_error�s"

�z-PydocImportTest.test_url_search_package_errorz(causes undesirable side-effects (#20128)c	CsZd}d}d}|||}t�}tj|d�}|d�|����}t|���}|�||�dS)NrV��r��modules)rr!r�r�r#�lenr�ZassertGreaterEqual)	rJZnum_header_linesZnum_module_lines_minZnum_footer_linesr�r.r�rQZ	num_linesrrr�test_modules�szPydocImportTest.test_modulesc	CsHd}t�}tj|d�}t��}|d�W5QRX|��}|�||�dS)Nzpydoc - r�z
modules pydoc)rr!r�r
r�rl�rJr�r.r�r�rQrrr�test_modules_search�sz#PydocImportTest.test_modules_searchz+some buildbots are not cooperating (#20128)c	CsLd}t�}tj|d�}t��}|d�W5QRX|��}|�|�|��dS)Nzgc - r�zmodules garbage)rr!r�r
r�r��
startswithrrrr�test_modules_search_builtin�sz+PydocImportTest.test_modules_search_builtincCsJt�tj�}|�|t�|�|jd�|�|jtj�|�|jtj�dS)Nr!)r!Z
importfiler"ZassertIsNotrOr�__spec__)rJZloaded_pydocrrr�test_importfiles
zPydocImportTest.test_importfileN)rrrr�r�rrrrr��skiprrrrrrrrr�ps


r�c@seZdZdd�Zdd�Zdd�Zdd�Zed	d
��Zedd��Z	d
d�Z
edd��Zdd�Z
dd�Zedd��Zedd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zed'd(��Zed)d*��Zed+d,��Zed-d.��Zd/d0�Zd1d2�Zd3S)4�TestDescriptionscCs&ddlm}t�|�}|�d|�dS)Nr)�pydocfodderr)r�rr!rkrl)rJrr-rrr�test_modules
zTestDescriptions.test_modulecCsVGdd�d�}|�}|�t�|�d�|�t�|�d�dt}|�|t�|��dS)Nc@seZdZdZdS)z&TestDescriptions.test_class.<locals>.CzNew-style classNrrrrr�Csrzclass CzC in module %s object)rOr!Zdescriberrlrk)rJr�cr�rrr�
test_classszTestDescriptions.test_classcCs�tjtjttjtjttjfd�dd�}t�d�}Gdd�dtj|tjtt	f�}|�
t�|��
�dd�|�
t�|��
�d	d
�dS)N)�datar��returncSsdSrDr)r"r�rrr�foosz/TestDescriptions.test_typing_pydoc.<locals>.foo�Tc@seZdZdS)z-TestDescriptions.test_typing_pydoc.<locals>.CNrwrrrrrsr���z?ffoooo(data: List[Any], x: int) -> Iterator[Tuple[int, Any]]rVz2class CC(collections.abc.Mapping, typing.Generic))�typingZListZAny�int�IteratorZTupleZTypeVarZGeneric�Mappingr}rOr!rkr�)rJr$r%rrrr�test_typing_pydocs
�
"��z"TestDescriptions.test_typing_pydocc	Cs|dD]H}|�t�|��zt�|�Wqtk
rJ|�d�|��YqXqdD]$}|�t�|��|�ttj|�qRdS)N)r}z
str.translatezbuiltins.strzbuiltins.str.translatezfinding the doc of {!r} failed)ZnotbuiltinsZstrrrzstrr.translatezstr.trrrranslatezbuiltins.strrrzbuiltins.str.trrranslate)	ZassertIsNotNoner!Zlocaterk�ImportErrorZfailr�r��assertRaises�rJ�namerrr�test_builtin&szTestDescriptions.test_builtincCs2t�t�|��}|�d�}t|�dks*t�|dS�Nr rV)r!�plainrk�splitr�AssertionError��or>�linesrrr�_get_summary_line7s
z"TestDescriptions._get_summary_linecCs,t�t�|��}|�d�}d�|dd��Sr1)r!r2rkr3r�r5rrr�_get_summary_lines>s
z#TestDescriptions._get_summary_linescCs|�|�tjj�d�dS)Nzwrap(self, text))rOr8r��TextWrapper�wrapr�rrr�test_unbound_python_methodEs�z+TestDescriptions.test_unbound_python_methodcCs|�|�tjj�d�dS)Nzdump(self, obj, /))rOr8�_pickle�Pickler�dumpr�rrr�test_unbound_builtin_methodIs�z,TestDescriptions.test_unbound_builtin_methodcCs t��}|�|�|j�d�dS)Nz2wrap(text) method of textwrap.TextWrapper instance)r�r:rOr8r;)rJ�trrr�test_bound_python_methodOs�z)TestDescriptions.test_bound_python_methodcCs~tddddg�}t�|�}|�|�d�|�d��|�|�d�|�d��Gdd�d�}Gdd�d�}t�|�t�|�dS)	Nr�r�r�Zagegroupc@seZdZdZdS)zMTestDescriptions.test_field_order_for_named_tuples.<locals>.NonIterableFieldsN�rrr�_fieldsrrrr�NonIterableFieldsYsrEc@seZdZggZdS)zMTestDescriptions.test_field_order_for_named_tuples.<locals>.NonHashableFieldsNrCrrrr�NonHashableFields\srF)rr!rkZ
assertLess�index)rJr�rrErFrrr�!test_field_order_for_named_tuplesSs

z2TestDescriptions.test_field_order_for_named_tuplescCs(t�}t�|�}|�|�|j�d�dS)Nz/dump(obj, /) method of _pickle.Pickler instance)rr=r>rOr8r?)rJr�prrr�test_bound_builtin_methodcs

�z*TestDescriptions.test_bound_builtin_methodcCs|�|�tj�d�dS)Nz0stat(path, *, dir_fd=None, follow_symlinks=True))rOr8r2rr�rrr�test_module_level_callableks�z+TestDescriptions.test_module_level_callablecCsVGdd�d�}|�|�|jd�d�|�|�|j�d�|�dt�t�|���dS)Nc@seZdZedd��ZdS)z-TestDescriptions.test_staticmethod.<locals>.XcSsdS)zA static methodNr�r��yrrr�smssz0TestDescriptions.test_staticmethod.<locals>.X.smN)rrr�staticmethodrNrrrr�XrsrPrNz<staticmethod object>zsm(x, y)
    A static method
zL
 |  Static methods defined here:
 |  
 |  sm(x, y)
 |      A static method
)rOr9�__dict__rNrlr!r2rk�rJrPrrr�test_staticmethodps��z"TestDescriptions.test_staticmethodcCsVGdd�d�}|�|�|jd�d�|�|�|j�d�|�dt�t�|���dS)Nc@seZdZedd��ZdS)z,TestDescriptions.test_classmethod.<locals>.XcSsdS)zA class methodNr)�clsr�rrr�cm�sz/TestDescriptions.test_classmethod.<locals>.X.cmN)rrr�classmethodrUrrrrrP�srPrUz<classmethod object>z:cm(x) method of builtins.type instance
    A class method
zZ
 |  Class methods defined here:
 |  
 |  cm(x) from builtins.type
 |      A class method
)rOr9rQrUrlr!r2rkrRrrr�test_classmethod�s��z!TestDescriptions.test_classmethodcCsT|�|�tj�d�|�|�tj�d�|�|�tj�d�|�|�tj	�d�dS)N�	numerator�realr$�obj)
rOr8r(rX�floatrYr�r$�
memoryviewrZr�rrr�test_getset_descriptor�sz'TestDescriptions.test_getset_descriptorcCsh|�|�tj�d�|�|�tj�d�|�|�tj�d�|�|�tj�d�|�|�t	j
�d�dS)NrY�start�fget�value)rOr8�complexrY�ranger^�slice�propertyr_�
StopIterationr`r�rrr�test_member_descriptor�s
z'TestDescriptions.test_member_descriptorcCs&Gdd�d�}|�|�|j�d�dS)Nc@seZdZdZdS)z4TestDescriptions.test_slot_descriptor.<locals>.PointrLN)rrr�	__slots__rrrr�Point�srhr�)rOr8r�)rJrhrrr�test_slot_descriptor�sz%TestDescriptions.test_slot_descriptorcCs*Gdd�d�}|�|�|jd�d�dS)Nc@seZdZdS)z6TestDescriptions.test_dict_attr_descriptor.<locals>.NSNrwrrrr�NS�srjrQ)rOr8rQ)rJrjrrr�test_dict_attr_descriptor�s�z*TestDescriptions.test_dict_attr_descriptorcCsl|�|�ttj�j�d�|�|�ttj�j�d�|�|�ttj�j	�d�|�|�ttj
�j�d�dS)N�width�debug�major�max)rOr8r�rr�	hash_inforlr�rm�version_inforn�
float_inforor�rrr� test_structseq_member_descriptor�s����z1TestDescriptions.test_structseq_member_descriptorcCs"tdd�}|�|�|j�d�dS)N�Box)rlZheightz    Alias for field number 0
)rrOr9rl)rJrtrrr� test_namedtuple_field_descriptor�s
z1TestDescriptions.test_namedtuple_field_descriptorcCs>Gdd�d�}|�|�|j�d�|�dt�t�|���dS)Nc@seZdZedd��ZdS)z,TestDescriptions.test_property.<locals>.RectcSs|j|jS)zArea of the rect)r��hr�rrr�area�sz1TestDescriptions.test_property.<locals>.Rect.areaN)rrrrdrwrrrr�Rect�srxz    Area of the rect
z#
 |  area
 |      Area of the rect
)rOr9rwrlr!r2rk)rJrxrrr�
test_property�s
�zTestDescriptions.test_propertycspGdd�d��G�fdd�d�}|�|�|j�d�d|j_|�|�|j�d�d|j_|�|�|j�d�dS)	Nc@seZdZdd�ZdS)z?TestDescriptions.test_custom_non_data_descriptor.<locals>.DescrcSs|dkr|SdS�Nrvr�rJrZrTrrr�__get__�szGTestDescriptions.test_custom_non_data_descriptor.<locals>.Descr.__get__N)rrrr|rrrr�Descr�sr}cseZdZ��ZdS)z;TestDescriptions.test_custom_non_data_descriptor.<locals>.XN�rrr�attrr�r}rrrP�srPzX<test.test_pydoc.TestDescriptions.test_custom_non_data_descriptor.<locals>.Descr object>�Custom descriptorr$zfoo(...)
    Custom descriptor
�rOr9rrrrRrr�r�test_custom_non_data_descriptor�sz0TestDescriptions.test_custom_non_data_descriptorcspGdd�d��G�fdd�d�}|�|�|j�d�d|j_|�|�|j�d�d|j_|�|�|j�d	�dS)
Nc@seZdZdd�Zdd�ZdS)z;TestDescriptions.test_custom_data_descriptor.<locals>.DescrcSs|dkr|SdSrzrr{rrrr|�szCTestDescriptions.test_custom_data_descriptor.<locals>.Descr.__get__cSsdddS)Nrfrrr{rrr�__set__�szCTestDescriptions.test_custom_data_descriptor.<locals>.Descr.__set__N)rrrr|r�rrrrr}�sr}cseZdZ��ZdS)z7TestDescriptions.test_custom_data_descriptor.<locals>.XNr~rr�rrrP�srPrr�z    Custom descriptor
r$zfoo
    Custom descriptor
r�rRrr�r�test_custom_data_descriptor�sz,TestDescriptions.test_custom_data_descriptorcCsJtd�dd�}t�tj�|��}|�d|�t���|�}|�d|�dS)N)r#c�sdS�Nrfr)Zignrrr�
coro_functionsz=TestDescriptions.test_async_annotation.<locals>.coro_functionzasync coro_functionz4async <a name="-coro_function"><strong>coro_function)r(r!r2�	plaintext�documentrlr))rJr�r>�htmlrrr�test_async_annotation
s�z&TestDescriptions.test_async_annotationcCsDdd�}t�tj�|��}|�d|�t���|�}|�d|�dS)NcSs
dVdSr�rrrrr�an_async_generatorszLTestDescriptions.test_async_generator_annotation.<locals>.an_async_generatorzasync an_async_generatorz>async <a name="-an_async_generator"><strong>an_async_generator)r!r2r�r�rlr))rJr�r>r�rrr�test_async_generator_annotations�z0TestDescriptions.test_async_generator_annotationN)rrrrr!r+r0rOr8r9r<r
r@rBrHrJrKrSrWr]rfrirkrsruryr�r�r�r�rrrrr	sR	








	







rc@seZdZdZdd�ZdS)�PydocServerTestzTests for pydoc._start_servercCsxdd�}tj|ddd�}|�d|jj�t��}d}|jrft�d�|jr4t��||kr4|�	�qfq4|�
|jd�dS)NcSsd||f}|S)Nzthe URL sent was: (%s, %s)r)rPZcontent_typer>rrr�my_url_handler(sz3PydocServerTest.test_server.<locals>.my_url_handlerz0.0.0.0r)ZhostnameZportrfg{�G�z�?)r!Z
_start_serverrlZ	docserverZaddress�time�	monotonicZserving�sleep�stoprO�error)rJr�ZserverthreadZ	starttimeZtimeoutrrr�test_server%s
zPydocServerTest.test_serverN)rrrrr�rrrrr�"sr�c@s eZdZdZdd�Zdd�ZdS)�PydocUrlHandlerTestzTests for pydoc._url_handlercCs*tj}|�t|dd�|�t|dd�dS)Nrxrry�foobar)r!rNr-�	TypeError)rJr�rrr�test_content_type_err>sz)PydocUrlHandlerTest.test_content_type_errcCsLddddddddd	d
dg}|��� |D]\}}|�||�q(W5QRXdS)N)r�Pydoc: Index of Modules)zget?key=r�)rGr�)Ztopicsz
Pydoc: Topics)�keywordszPydoc: Keywords)r!�Pydoc: module pydoc)z
get?key=pydocr�)zsearch?key=pydocr
)z
topic?key=defzPydoc: KEYWORD def)ztopic?key=STRINGSzPydoc: TOPIC STRINGS)r�zPydoc: Error - foobar)rMrR)rJZrequestsrPrArrr�test_url_requestsCs�
z%PydocUrlHandlerTest.test_url_requestsN)rrrrr�r�rrrrr�;sr�c@seZdZdd�ZdS)�
TestHelpercCs|�ttjj�ttj��dSrD)rO�sortedr!r�r��keyword�kwlistr�rrr�
test_keywords[s�zTestHelper.test_keywordsN)rrrr�rrrrr�Zsr�c@s�eZdZe�ejjdkd�e�eed�o.e�	�d�dd���Z
e�ejjdkd�e�eed�ode�	�d�dd���Ze�ejjdkd�e�eed�o�e�	�d�d	d
���Ze�ejjdkd�e�eed�o�e�	�d�dd���Z
d
d�ZdS)�PydocWithMetaClassesrVrWrXrYcCs�Gdd�dt�}Gdd�d|d�}tdd�tD��}t�}tj|d�}||�ttf|dd	�}|���	�}|�
||�dS)
NcseZdZ�fdd�Z�ZS)z=PydocWithMetaClasses.test_DynamicClassAttribute.<locals>.Metacs|dkrdSt��|�S)N�hamZspam��super�__getattr__r.�r�rrr�fszIPydocWithMetaClasses.test_DynamicClassAttribute.<locals>.Meta.__getattr__)rrrr��
__classcell__rrr�r�Metaesr�c@seZdZejdd��ZdS)z;PydocWithMetaClasses.test_DynamicClassAttribute.<locals>.DAcSsdS)NZeggsrr�rrrr�ksz?PydocWithMetaClasses.test_DynamicClassAttribute.<locals>.DA.hamN)rrr�types�DynamicClassAttributer�rrrr�DAjsr���	metaclasscss|]}|rd|ndVqdS)z	
 |      rNrrrrrrns�zBPydocWithMetaClasses.test_DynamicClassAttribute.<locals>.<genexpr>r�rV)r�r�expected_data_docstringsrr!r��!expected_dynamicattribute_patternrr�r#rO)rJr�r�rcr.r�rdrQrrr�test_DynamicClassAttribute`s��z/PydocWithMetaClasses.test_DynamicClassAttributecCs`Gdd�dt�}Gdd�d|d�}t�}tj|d�}||�tt}|����}|�||�dS)Ncs$eZdZdd�Z�fdd�Z�ZS)zHPydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.<locals>.MetacSsddddgS)Nr�rr�LIFEr�rTrrr�__dir__~szPPydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.<locals>.Meta.__dir__cs|dkrdSt��|�S)Nr�rv)r�Z_Meta__getattrr.r�rrr��szTPydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.<locals>.Meta.__getattr__�rrrr�r�r�rrr�rr�}sr�c@seZdZdS)zIPydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.<locals>.ClassNrwrrrr�Class�sr�r�r�)	r�rr!r��"expected_virtualattribute_pattern1rr�r#rO)rJr�r�r.r�rdrQrrr�%test_virtualClassAttributeWithOneMetaxsz:PydocWithMetaClasses.test_virtualClassAttributeWithOneMetacs�Gdd�dt��Gdd�dt��G��fdd�d���}Gdd�d�d	�}Gd
d�d||d	�}d}}t�}tj|d
�}||�tt}|����}	|�||	�t�}tj|d
�}||�t	t}
|����}|�|
|�dS)Ncs$eZdZdd�Z�fdd�Z�ZS)zIPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta1cSsddddgS)Nr�rrrgrr�rrrr��szQPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta1.__dir__cs|dkrdSt��|�S)Nrgrfr�r.r�rrr��szUPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta1.__getattr__r�rrr�r�Meta1�sr�cs$eZdZdd�Z�fdd�Z�ZS)zIPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta2cSsddddgS)Nr�rr�tworr�rrrr��szQPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta2.__dir__cs|dkrdSt��|�S)Nr�rVr�r.r�rrr��szUPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta2.__getattr__r�rrr�r�Meta2�sr�cs*eZdZ��fdd�Z�fdd�Z�ZS)zIPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta3cs,tttddddg��|���|����S)Nr�rr�three)�listr��setr�r��r�r�rrr��s
���zQPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta3.__dir__cs|dkrdSt��|�S)Nr�rr�r.r�rrr��szUPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta3.__getattr__r�rr�r�r�Meta3�sr�c@seZdZdS)zJPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Class1Nrwrrrr�Class1�sr�r�c@seZdZdS)zJPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Class2Nrwrrrr�Class2�sr�Fr�)
r�rr!r��"expected_virtualattribute_pattern2rr�r#rO�"expected_virtualattribute_pattern3)rJr�r�r�Zfail1Zfail2r.r�Zexpected_text1Zresult1Zexpected_text2Zresult2rr�r�%test_virtualClassAttributeWithTwoMeta�s$	z:PydocWithMetaClasses.test_virtualClassAttributeWithTwoMetacCs`Gdd�dt�}Gdd�d|d�}t�}tj|d�}||�tt}|����}|�||�dS)Nc@seZdZdd�ZdS)z.PydocWithMetaClasses.test_buggy_dir.<locals>.McSsddddgS)Nr�rZmissing�hererr�rrrr��sz6PydocWithMetaClasses.test_buggy_dir.<locals>.M.__dir__N)rrrr�rrrr�M�sr�c@seZdZdZdS)z.PydocWithMetaClasses.test_buggy_dir.<locals>.Czpresent!N)rrrr�rrrrr�srr�r�)	r�rr!r��!expected_missingattribute_patternrr�r#rO)rJr�rr.r�rdrQrrr�test_buggy_dir�sz#PydocWithMetaClasses.test_buggy_dirc	Cs4t��}t�d�W5QRX|��}|�d|�dS)Nz	enum.Enumz
class Enum)r
r!r�r�rl)rJr�r�rrr�test_resolve_false�sz'PydocWithMetaClasses.test_resolve_falseN)rrrr�r�rrr�r�r�rXr�r�r�r�r�rrrrr�_s:������*��
r�c@sFeZdZdd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�TestInternalUtilitiescCsNt��}|j|_tj�|jd�|_|�|j	�t�
�|_}dtj|g|_
dS)NZnonexistentr)�tempfileZTemporaryDirectoryr/�argv0dirr2r3r��argv0r�Zcleanup�getcwd�
abs_curdir�curdir�curdir_spellings)rJZtmpdirr�rrrr��szTestInternalUtilities.setUpNcCs|dkr|j}t�||�SrD)r�r!�_get_revised_path)rJ�
given_pathr�rrrr��sz'TestInternalUtilities._get_revised_pathcCs8tj��}|jD]"}t|�|��D]}|�|�q"q|SrD)rrr3�copyr�rb�countr�)rJ�
clean_path�spelling�__rrr�_get_starting_path�s


z(TestInternalUtilities._get_starting_pathcCs*|��}|jg|}|�|�|�|�dSrD)r�r�rOr�)rJr��
expected_pathrrr�,test_sys_path_adjustment_adds_missing_curdir�szBTestInternalUtilities.test_sys_path_adjustment_adds_missing_curdircCsT|��}|jg|}|jg|}|�|�|�|�||jg}|�|�|�|�dSrD)r�r�r�rOr�)rJr�r��leading_argv0dir�trailing_argv0dirrrr�*test_sys_path_adjustment_removes_argv0_dir�sz@TestInternalUtilities.test_sys_path_adjustment_removes_argv0_dircsh�fdd�}���}�jg|}�jg|}��||�|�|�jg}�jg|}��||�|�dS)Ncs�j|tjd�S)N)r�)r�r!r")r�r�rrr��sz\TestInternalUtilities.test_sys_path_adjustment_protects_pydoc_dir.<locals>._get_revised_path)r�r�r�rO)rJr�r�r�r�r�rr�r�+test_sys_path_adjustment_protects_pydoc_dir�szATestInternalUtilities.test_sys_path_adjustment_protects_pydoc_dirc
Cs�|��}|jD]�}|j|d��r|g|}|�|�|��||g}|�|�|��|jg|}|�|�|��||jg}|�|�|��W5QRXqdS)N)Zcurdir_spelling)r�r�ZsubTestr�r�r�)rJr�r�Zleading_curdirZtrailing_curdirr�r�rrr�5test_sys_path_adjustment_when_curdir_already_includeds


zKTestInternalUtilities.test_sys_path_adjustment_when_curdir_already_included)N)
rrrr�r�r�r�r�r�r�rrrrr��s
	r�c
Cs,ztj�tttttt	t
t�W5t�XdSrD)rr�r�Zrun_unittestrUr�rr�r�r�r�r�rrrr�	test_mains�
r��__main__)Or2rrrS�importlib.utilr�rZr!r�r�r=rLr9r�stringr�Ztest.supportr�r�r�r'r�Zurllib.parser\Z	xml.etreernZxml.etree.ElementTreer��ior�collectionsrZtest.support.script_helperrrrrrr	r
rrr
rrr�ZHAVE_DOCSTRINGSr�r#rbrrcr^r_r�linesepr~r�r�r�r�r�r�r(r0r7r<rBZTestCaserCrUr�rr�r�r�r�r�r�rrrrr�<module>s�,
T�{��			
		QvA