HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_pydoc.cpython-310.opt-2.pyc
o

�i#��@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZddl m!Z!ddlm"Z"ddlm#Z#m$Z$m%Z%m&Z&m'Z'ddl(m)Z)m*Z*m+Z+dd	lm,Z,Gd
d�d�Z-ej.j/r�dZ0nd
Z0d�1�Z2e3dd�e0D��Z4d�1�Z5e3dd�e0D��Z6d�7dej8�Z9dZ:d�1�Z;d�1�Z<d�1�Z=d�1�Z>d�1�Z?dd�Z@dd�ZAdd �ZBd!d"�ZCd#d$�ZDGd%d&�d&ejE�ZFGd'd(�d(ejE�ZGGd)d*�d*eF�ZHGd+d,�d,ejE�ZIGd-d.�d.ejE�ZJGd/d0�d0eF�ZKGd1d2�d2ejE�ZLGd3d4�d4ejE�ZMGd5d6�d6ejE�ZNd7d8�ZOePd9k�rQe�Q�dSdS):�N)�StringIO)�
namedtuple)�	os_helper)�assert_python_ok)�threading_helper)�
reap_children�captured_output�captured_stdout�captured_stderr�requires_docstrings)�TESTFN�rmtree�unlink)�	pydoc_modc@seZdZ	dS)�nonasciiN��__name__�
__module__�__qualname__�rr�,/usr/local/lib/python3.10/test/test_pydoc.pyr#sr)�.dictionary for instance variables (if defined)�2list of weak references to the object (if defined)rr)�rrra�
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)
     |  
     |  ----------------------------------------------------------------------
     |  Class methods defined here:
     |  
     |  __class_getitem__(item) from builtins.type
     |  
     |  ----------------------------------------------------------------------
     |  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'
    c_alias = test.pydoc_mod.C[int]
    list_alias1 = typing.List[int]
    list_alias2 = list[int]
    type_union1 = typing.Union[int, str]
    type_union2 = int | str

VERSION
    1.2.3.4

AUTHOR
    Benjamin Peterson

CREDITS
    Nobody

FILE
    %s
cc� �|]}|r
d|ndVqdS)z
     |      rNr��.0�srrr�	<genexpr>����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="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%%"><table width="100%%" summary="list"><tr><td width="25%%" valign=top><a href="types.html">types</a><br>
</td><td width="25%%" valign=top><a href="typing.html">typing</a><br>
</td><td width="25%%" valign=top></td><td width="25%%" valign=top></td></tr></table></td></tr></table><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>
Class methods defined here:<br>
<dl><dt><a name="C-__class_getitem__"><strong>__class_getitem__</strong></a>(item)<font color="#909090"><font face="helvetica, arial"> from <a href="builtins.html#type">builtins.type</a></font></font></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'<br>
<strong>c_alias</strong> = test.pydoc_mod.C[int]<br>
<strong>list_alias1</strong> = typing.List[int]<br>
<strong>list_alias2</strong> = list[int]<br>
<strong>type_union1</strong> = typing.Union[int, str]<br>
<strong>type_union2</strong> = int | str</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!'
cOs4	||f}tdtjg|�Ri|��\}}}|��S)Nz-B)r�pydoc�__file__�strip)�module_name�args�env�rc�out�errrrr�	run_pydocns
 r,cCs>	t��}|�|�}|�t�pd}|rd|d}|��|fS)Nrz
<br><a href="z">Module Docs</a>)r#�HTMLDoc�	docmodule�	getdoclocrr%)�module�doc�output�locrrr�get_pydoc_htmlxs
r4cCs<	tjj}tjj}|||t���}t��}|j||d�}|S)N)�basedir)�os�path�abspath�dirnamer$r#�TextDocr/)r0r8r9r5r1r3rrr�get_pydoc_link�sr;cCsT	t��}|�t�pd}|rd|d}|�|�}t�d�}|�d|�}|��|fS)Nrz
MODULE DOCS
    r"�.)	r#r:r/rr.�re�compile�subr%)r0r1r3r2Zpattrrr�get_pydoc_text�s

r@cCs4|�d�\}}}|�d�\}}}|�d�\}}}|S)Nz</head>z<title>z</title>)�	partition)�text�header�_�titlerrr�get_html_title�srFc@s.eZdZddd�Zejddd��Zdd�ZdS)	�
PydocBaseTestNcs(	|p	tj�t�g�d��fdd�	}|S)Nrcs�|p�||�S�Nr)r7�prefix�onerror�Zdefault_path�
walk_packagesrr�wrapper��z8PydocBaseTest._restricted_walk_packages.<locals>.wrapper)NrN)r6r7r9r$)�selfrLr7rMrrKr�_restricted_walk_packages�sz'PydocBaseTest._restricted_walk_packagesccs2�tj}|�||�t_z	dVW|t_dS|t_wrH)�pkgutilrLrP)rOr7rLrrr�restrict_walk_packages�s��z$PydocBaseTest.restrict_walk_packagescCs&t�|d�}t|�}|�|||�|S)Nz	text/html)r#�_url_handlerrF�assertEqual)rO�urlZexpected_titlerB�resultrrr�call_url_handler�szPydocBaseTest.call_url_handlerrH)rrrrP�
contextlib�contextmanagerrRrWrrrrrG�s


	rGc@s�eZdZdZe�ejjdkd�e�e	ed�oe�
�d�edd����Ze�ejjdkd�e�e	ed�o6e�
�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}|�	||�dSrH)
r4r�inspect�
getabsfile�urllib�parse�quote�expected_html_pattern�expected_html_data_docstringsrT)rOrV�doc_locZmod_fileZmod_urlZ
expected_htmlrrr�
test_html_doc�s
��zPydocDocTest.test_html_doccCs6tt�\}}t|ftt�t�f}|�||�dSrH)r@r�expected_text_pattern�expected_text_data_docstringsr_r`rT)rOrVrf�
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�srnz<BinaryInteger.zero: 0>)�enum�IntEnumr#�
render_doc�assertIn)rOrornr1rrr�%test_text_enum_member_with_value_zero�s
z2PydocDocTest.test_text_enum_member_with_value_zerocCsttjj�}|�d|�dS)Nzxml.etree.elementtree)r;�xml�etreeZElementTreerr)rOZdoc_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@rtrurT)rOrVrfrrr�test_issue8225�szPydocDocTest.test_issue8225cCs*tj}z
dt_t��W|t_dS|t_wrH)�sys�stdinr#�getpager)rOZprevious_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�*Nrrrrr�A��r}c@�eZdZdS)z)PydocDocTest.test_non_str_name.<locals>.BNrrrrr�B��r�)r#rqrTr!)rOr}r�ZadocZbdocrrr�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_patternrT�rOZmissing_modulerV�expectedrrr�
test_not_heres�zPydocDocTest.test_not_herez)Docstrings are omitted with -OO and abovecCs*tddd�}tj�dd�}|�||�dS)Nztest.test_pydoc.nonasciir�)ZPYTHONIOENCODING�backslashreplace)r,r�__doc__�encoderr)rOrV�encodedrrr�test_not_asciiszPydocDocTest.test_not_asciicCs.d}tt|�d�}t|��}|�||�dS)Nz test.i_am_not_here r�)r�r,r�r%rTr�rrr�test_input_strips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#�stripidrT)rOr�rrr�test_stripids
�
�
�zPydocDocTest.test_stripidcCs(	t��}|�t�}d}|�||�dS)Nz� |  Built-in subclasses:
 |      async_generator
 |      BaseException
 |      builtin_function_or_method
 |      bytearray
 |      ... and \d+ other subclasses)r#r:�docclass�objectZassertRegex�rOr1rBZsniprrr�)test_builtin_with_more_than_four_children%s

z6PydocDocTest.test_builtin_with_more_than_four_childrencCs(	t��}|�t�}d}|�||�dS)Nzc |  Built-in subclasses:
 |      FloatingPointError
 |      OverflowError
 |      ZeroDivisionError)r#r:r��ArithmeticErrorrrr�rrr�test_builtin_with_childDs

z$PydocDocTest.test_builtin_with_childcCs4	t��}|�t�}d}|�||�|�d|�dS)Nz^ |  Built-in subclasses:
 |      ArithmeticError
 |      AssertionError
 |      AttributeError�ZeroDivisionError)r#r:r��	Exceptionrr�assertNotInr�rrr�test_builtin_with_grandchild_s
z)PydocDocTest.test_builtin_with_grandchildcC�$	t��}|�t�}|�d|�dS�NzBuilt-in subclasses)r#r:r�r�r��rOr1rBrrr�test_builtin_no_childs
z"PydocDocTest.test_builtin_no_childcCr�r�)r#r:r��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_zbtd��J}td��6}|�|�|�
���}
|
|ftt�t�f}|�d|�
��|�d|�
��|�||
�Wd�n1spwYWd�n1swYW|t_dSW|t_dS|t_w)	NcSsdd�S)NcSs|SrHr)�xrrr�<lambda>�szJPydocDocTest.test_help_output_redirect.<locals>.<lambda>.<locals>.<lambda>rrrrrr��sz8PydocDocTest.test_help_output_redirect.<locals>.<lambda>�r2ztest.pydoc_modz9
        Help on module test.pydoc_mod in test:

        �stdout�stderrr)rhr#rz�maxDiffr�Helperr@r�lstrip�textwrap�dedentr�help�getvaluer%rir_r`rT)rOZold_patternZgetpager_oldZgetpager_new�buf�helperZunusedrfr0Zhelp_headerZexpected_help_patternr2r+rVrjrrr�test_help_output_redirect�sJ�

�
�
����
�z&PydocDocTest.test_help_output_redirectcCsztdddg�}t��
}t�|�Wd�n1swY|��}|�d|�|�d|�|�d|�|�d|�dS)N�Person�nickname�	firstnamezAlias for field number 0zAlias for field number 1�rr	r#r�r�rr)rOr��help_io�helptextrrr�test_namedtuple_fields�s�z#PydocDocTest.test_namedtuple_fieldscCsrtdddgdd�}t��
}t�|�Wd�n1swY|��}|�d|�|�d|�|�d|�dS)	N�NT�abc�defT)�renameZ_1�_replace�_asdictr�)rOr�r�r�rrr�!test_namedtuple_public_underscore�s�z.PydocDocTest.test_namedtuple_public_underscorec	Cs�|�tt�dD]>}ttd|d��!}|dkrtd�|�|d�td|d�td|d�Wd�n1s5wYt�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é)	�
addCleanuprr�open�print�formatr#�synopsisrT)rOr�Zscriptr�rrr�
test_synopsis�s��zPydocDocTest.test_synopsiscCs.tj��d}tj}t�|�}|�||�dS)Nr)r6r��
splitlines�
__cached__r#r�rT)rOr��filenamer�rrr�test_synopsis_sourceless�s
z%PydocDocTest.test_synopsis_sourcelessc	Cs�t���K}tj�|d�}tj�|�}t|d��
}|�	d�Wd�n1s'wYt
�|�t�
|i�}|�|�t�
|i�}|�|�Wd�dS1sRwYdS)Nzfoomod42.pyr��foo = 1)r�temp_cwdr6r7�join�	importlib�util�cache_from_sourcer��write�
py_compiler>r#r��assertIsNone)rO�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)rTr#Zsplitdoc)rOZexample_stringrrr�test_splitdoc_with_descriptions�z+PydocDocTest.test_splitdoc_with_descriptioncCs>t���}|�t�|��Wd�dS1swYdSrH)rr�ZassertFalser#�	ispackage)rOr�rrr� test_is_package_when_not_packages
"�z-PydocDocTest.test_is_package_when_not_packagecCsdt���$}tj�|d�}t|d���|�t�	|��t�
|�Wd�dS1s+wYdS)N�__init__.pyr�)rr�r6r7r�r��close�
assertTruer#r��remove)rOr�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@�eZdZdd�ZdS)z/PydocDocTest.test_allmethods.<locals>.TestClasscS�dS)NTr�rOrrr�method_returning_true�zEPydocDocTest.test_allmethods.<locals>.TestClass.method_returning_trueN)rrrr�rrrr�	TestClass�r�r�r��	__class__�__subclasshook__�__init_subclass__)	r��dict�varsr�r�r�r#Z
allmethodsZassertDictEqual)rOr�r��methodsrrr�test_allmethodss



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>.ANcS�dSrHr)rOZ	aboveThisrrr�tkraise,r�z3PydocDocTest.test_method_aliases.<locals>.A.tkraisecSr�rHrr�rrr�a_size/r�z2PydocDocTest.test_method_aliases.<locals>.A.a_sizerH)rrrr�Zliftr�rrrrr}+s
r}cs eZdZddd�ZeZ�jZdS)z+PydocDocTest.test_method_aliases.<locals>.BNc[r�rHr)rOZtagOrIdZcnf�kwrrr�
itemconfigure2r�z9PydocDocTest.test_method_aliases.<locals>.B.itemconfigurerH)rrrr�Z
itemconfigr�Zb_sizer�r}rrr�1s

r�r<ra�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#rqr=r?rTrr-)rOr�r1rr�r�test_method_aliases*s
%�'(
�z PydocDocTest.test_method_aliases)'rrrr��unittest�skipIfrx�flags�optimize�hasattrr]rrgrkrsrvrwr{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrZ�sp��	��
�

 ��#
	�
rZc@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��dSrH)r6�mkdirrr�r�r
r��invalidate_cachesr�rrr�setUp�szPydocImportTest.setUpc		Cs�d}dddd�|�dfd�|�d�|�ff}tj�t|�tjd}|D]6\}}t|d	��}|�d
�|��Wd�n1s@wYt|td��	d�}t
||f}|�||�q$dS)
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.{}rztest.{}�pyr�z
import {}
)Z
PYTHONPATHr�)r�r6r7r�r�extsepr�r�r,�decode�badimport_patternrT)	rO�modnameZ	testpairsZsourcefnZimportstringZ
expectedinmsg�frVr�rrr�test_badimport�s ���zPydocImportTest.test_badimportc
Cs�tj�td�}t�|�tj�|d�tjd}t|d��
}|�d�Wd�n1s-wY|jtgd���t	�� }t
��
}t�d�Wd�n1sQwYWd�n1s`wY|�
|��d�|�
|��d�t	�� }t
��
}t�d�Wd�n1s�wYWd�n1s�wY|�
|����d�|�
|��d�Wd�dS1s�wYdS)	NZ	syntaxerr�__init__rr�zinvalid python syntax = $1
�r7Zxyzzyr)r6r7r�rr�rr�r�rRr	r
r#�aproposrTr�r%)rO�pkgdirZ	badsyntaxr	r*r+rrr�test_apropos_with_bad_package�s0
�������"�z-PydocImportTest.test_apropos_with_bad_packagec
Cs�tj�td�|_t�|jd�|�tj|j�|jtgd��3t	�� }t
��
}t�d�Wd�n1s6wYWd�n1sEwYWd�n1sTwY|�
|��d�|�
|��d�dS)NZ
unreadablerrZSOMEKEYr)r6r7r�rZunreadable_dirr�r��rmdirrRr	r
r#r
rTr�)rOr*r+rrr� test_apropos_with_unreadable_dir�s�����z0PydocImportTest.test_apropos_with_unreadable_dirc
Cstj�td�}t�|�|�t|�tj�|d�}t|d��
}|�d�Wd�n1s.wYt	�
t�	|�j�}zJt�||t	j
@�|jtgd�� t��
}t�d�Wd�n1sbwYWd�n1sqwY|�d|���Wt�||�dSt�||�w)NZwalkpkgr�r�r�rr)r6r7r�rr�r�r
r�r��stat�S_IMODE�st_mode�chmod�S_IEXECrRr	r#r
rrr�)rOrr�r�Zcurrent_moder�rrr�test_apropos_empty_doc�s"
���z&PydocImportTest.test_apropos_empty_doccCstj�td�}t�|�tj�|d�}t|ddd��
}|�d�Wd�n1s*wY|jtgd��Ott	j�}t	j�
dt�z1|�td	��ddl
}Wd�n1sYwY|�d
d�}d}|�||�W|t	jdd�<n|t	jdd�<wWd�dS1s�wYdS)
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>)r6r7r�rr�r�r�rR�tuplerx�insertZassertRaisesRegex�
ValueErrorrrWrr)rOrZinitr	Zsaved_pathsrrB�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)Nr[��r��modules)rr#r�r�r%�lenr�ZassertGreaterEqual)	rOZnum_header_linesZnum_module_lines_minZnum_footer_linesr�r2r�rVZ	num_linesrrr�test_modules�szPydocImportTest.test_modulescCs\d}t�}tj|d�}t��}|d�Wd�n1swY|��}|�||�dS)Nzpydoc - r�z
modules pydoc)rr#r�r	r�rr�rOr�r2r�r�rVrrr�test_modules_searchs
�z#PydocImportTest.test_modules_searchz+some buildbots are not cooperating (#20128)cCs`d}t�}tj|d�}t��}|d�Wd�n1swY|��}|�|�|��dS)Nzgc - r�zmodules garbage)rr#r�r	r�r��
startswithr$rrr�test_modules_search_builtins
�z+PydocImportTest.test_modules_search_builtincCsJt�tj�}|�|t�|�|jd�|�|jtj�|�|jtj�dS)Nr#)r#Z
importfiler$ZassertIsNotrTr�__spec__)rOZloaded_pydocrrr�test_importfiles
zPydocImportTest.test_importfileN)rrrrr
rrrrr��skipr#r%r'r)rrrrr��s


r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	e
dd��Ze
dd��Zdd�Z
edd��Zdd�Zdd�Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zed'd(��Zed)d*��Zed+d,��Zed-d.��Zed/d0��Zed1d2��Zed3d4��Zd5d6�Zd7d8�Z d9d:�Z!d;S)<�TestDescriptionscCs&ddlm}t�|�}|�d|�dS)Nr)�pydocfodderr,)�testr,r#rqrr)rOr,r1rrr�test_module(s
zTestDescriptions.test_modulecCsVGdd�d�}|�}|�t�|�d�|�t�|�d�dt}|�|t�|��dS)Nc@r)z&TestDescriptions.test_class.<locals>.CNrrrrr�C/�r/zclass CzC in module %s object)rTr#�describerrrrq)rOr/�cr�rrr�
test_class.szTestDescriptions.test_classcCs�|�t�tjt�d�tjtjttjd�}|�d|�|�d|�|�t	j
����d|�|�t�t	t�d�tjt	ttjd�}|�d|�|�d|�|�t	j
����d|�dS)	NZ
_GenericAliasr�z_GenericAlias in module typingzList = class list(object)r�GenericAliaszGenericAlias in module builtinsz
class list(object))
rTr#r1�typing�List�intrq�	plaintextrr�listr�r%r��rOr1rrr�test_generic_alias7sz#TestDescriptions.test_generic_aliascCs�|�t�tjttf�d�tjtjttftjd�}|�	d|�|�	d|�tjj
r9|�	tjj
����d|�|�t�ttB�d�tjttBtjd�}|�	d|�|�	d|�|�	t
jj
����d|�dS)	NZ_UnionGenericAliasr�z#_UnionGenericAlias in module typingzUnion = typing.Unionr�	UnionTypez UnionType in module types objectz!
class UnionType(builtins.object))rTr#r1r5ZUnionr7r�rqr8rrr�r%r��typesr<r:rrr�test_union_typeDs z TestDescriptions.test_union_typecCsv|�t�tj�d�tjtjtjd�}|�d|�tjjr3|�d|�|�tjj�	��
�d|�dS|�d|�dS)NZ_SpecialFormr�z_SpecialForm in module typingzAny = typing.Anyrz Any = class _SpecialForm(_Final))rTr#r1r5�Anyrqr8rrr�r%r�r:rrr�test_special_formRs z"TestDescriptions.test_special_formc	Cs�dtjtjdtdtjtjttjffdd�}t�d�}Gdd�dtj|tjtt	f�}|�
t�|��
�d	d
�|�
t�|��
�dd�dS)
N�datar��returncSr�rHr)rAr�rrr�foo]�z/TestDescriptions.test_typing_pydoc.<locals>.foo�Tc@r)z-TestDescriptions.test_typing_pydoc.<locals>.CNrrrrrr/ar0r/���z?ffoooo(data: List[Any], x: int) -> Iterator[Tuple[int, Any]]r[z2class CC(collections.abc.Mapping, typing.Generic))r5r6r?r7�IteratorZTuple�TypeVarZGeneric�Mappingr�rTr#rqr�)rOrCrEr/rrr�test_typing_pydoc\s�
�
"��z"TestDescriptions.test_typing_pydocc	CsxdD]"}|�t�|��zt�|�Wqty$|�d�|��YqwdD]}|�t�|��|�ttj|�q'dS)N)r�z
str.translatezbuiltins.strzbuiltins.str.translatezfinding the doc of {!r} failed)ZnotbuiltinsZstrrrzstrr.translatezstr.trrrranslatezbuiltins.strrrzbuiltins.str.trrranslate)	ZassertIsNotNoner#Zlocaterq�ImportErrorZfailr�r��assertRaises�rO�namerrr�test_builtinhs��zTestDescriptions.test_builtincCs"t�t�|��}|�d�}|dS�Nr"r[)r#�plainrq�split��orB�linesrrr�_get_summary_lineys
z"TestDescriptions._get_summary_linecCs,t�t�|��}|�d�}d�|dd��SrP)r#rQrqrRr�rSrrr�_get_summary_lines�s
z#TestDescriptions._get_summary_linescC�|�|�tjj�d�dS)Nzwrap(self, text))rTrVr��TextWrapper�wrapr�rrr�test_unbound_python_method�s�z+TestDescriptions.test_unbound_python_methodcCrX)Nzdump(self, obj, /))rTrV�_pickle�Pickler�dumpr�rrr�test_unbound_builtin_method�s�z,TestDescriptions.test_unbound_builtin_methodcCs t��}|�|�|j�d�dS)Nz2wrap(text) method of textwrap.TextWrapper instance)r�rYrTrVrZ)rO�trrr�test_bound_python_method�s�z)TestDescriptions.test_bound_python_methodcCs|tdgd��}t�|�}|�|�d�|�d��|�|�d�|�d��Gdd�d�}Gdd	�d	�}t�|�t�|�dS)
Nr�)r�r��agegroupr�r�rbc@seZdZdZdS)zMTestDescriptions.test_field_order_for_named_tuples.<locals>.NonIterableFieldsN�rrr�_fieldsrrrr�NonIterableFields�r~rec@seZdZggZdS)zMTestDescriptions.test_field_order_for_named_tuples.<locals>.NonHashableFieldsNrcrrrr�NonHashableFields��
rf)rr#rqZ
assertLess�index)rOr�rrerfrrr�!test_field_order_for_named_tuples�s

z2TestDescriptions.test_field_order_for_named_tuplescCs(t�}t�|�}|�|�|j�d�dS)Nz/dump(obj, /) method of _pickle.Pickler instance)rr\r]rTrVr^)rOr�prrr�test_bound_builtin_method�s

�z*TestDescriptions.test_bound_builtin_methodcCs|�|�tj�d�dS)Nz0stat(path, *, dir_fd=None, follow_symlinks=True))rTrVr6rr�rrr�test_module_level_callable�s�z+TestDescriptions.test_module_level_callablecCsVGdd�d�}|�|�|jd�d�|�|�|j�d�|�dt�t�|���dS)Nc@�eZdZedd��ZdS)z-TestDescriptions.test_staticmethod.<locals>.XcS�	dSrHr�r��yrrr�sm��z0TestDescriptions.test_staticmethod.<locals>.X.smN)rrr�staticmethodrqrrrr�X��rtrqzsm(x, y)
    A static method
zL
 |  Static methods defined here:
 |  
 |  sm(x, y)
 |      A static method
)rTrW�__dict__rqrrr#rQrq�rOrtrrr�test_staticmethod����z"TestDescriptions.test_staticmethodcCsVGdd�d�}|�|�|jd�d�|�|�|j�d�|�dt�t�|���dS)Nc@rm)z,TestDescriptions.test_classmethod.<locals>.XcSrnrHr)�clsr�rrr�cm�rrz/TestDescriptions.test_classmethod.<locals>.X.cmN)rrr�classmethodr{rrrrrt�rurtr{zcm(...)
    A class method
z:cm(x) method of builtins.type instance
    A class method
zZ
 |  Class methods defined here:
 |  
 |  cm(x) from builtins.type
 |      A class method
)rTrWrvr{rrr#rQrqrwrrr�test_classmethod�ryz!TestDescriptions.test_classmethodcCsT|�|�tj�d�|�|�tj�d�|�|�tj�d�|�|�tj	�d�dS)N�	numerator�realr'�obj)
rTrVr7r~�floatrr�r'�
memoryviewr�r�rrr�test_getset_descriptor�sz'TestDescriptions.test_getset_descriptorcCsh|�|�tj�d�|�|�tj�d�|�|�tj�d�|�|�tj�d�|�|�t	j
�d�dS)Nr�start�fget�value)rTrV�complexr�ranger��slice�propertyr��
StopIterationr�r�rrr�test_member_descriptor�s
z'TestDescriptions.test_member_descriptorcCs&Gdd�d�}|�|�|j�d�dS)Nc@�eZdZdZdS)z4TestDescriptions.test_slot_descriptor.<locals>.PointroN)rrr�	__slots__rrrr�Point�r~r�r�)rTrVr�)rOr�rrr�test_slot_descriptor�sz%TestDescriptions.test_slot_descriptorcCs*Gdd�d�}|�|�|jd�d�dS)Nc@r)z6TestDescriptions.test_dict_attr_descriptor.<locals>.NSNrrrrr�NS�r�r�rv)rTrVrv)rOr�rrr�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)rTrVr�rx�	hash_infor�r�r��version_infor��
float_infor�r�rrr� test_structseq_member_descriptor�s����z1TestDescriptions.test_structseq_member_descriptorcCs"tdd�}|�|�|j�d�dS)N�Box)r�Zheightz    Alias for field number 0
)rrTrWr�)rOr�rrr� test_namedtuple_field_descriptors
z1TestDescriptions.test_namedtuple_field_descriptorcCs>Gdd�d�}|�|�|j�d�|�dt�t�|���dS)Nc@rm)z,TestDescriptions.test_property.<locals>.RectcSs	|j|jSrH)r��hr�rrr�areasz1TestDescriptions.test_property.<locals>.Rect.areaN)rrrr�r�rrrr�Rectrur�z    Area of the rect
z#
 |  area
 |      Area of the rect
)rTrWr�rrr#rQrq)rOr�rrr�
test_propertys
�zTestDescriptions.test_propertyc�pGdd�d��G�fdd�d�}|�|�|j�d�d|j_|�|�|j�d�d|j_|�|�|j�d	�dS)
Nc@r�)z?TestDescriptions.test_custom_non_data_descriptor.<locals>.DescrcS�|dur|SdS�Nr|r�rOr�rzrrr�__get__!�zGTestDescriptions.test_custom_non_data_descriptor.<locals>.Descr.__get__N)rrrr�rrrr�Descr r�r�c�eZdZ��ZdS)z;TestDescriptions.test_custom_non_data_descriptor.<locals>.XN�rrr�attrr�r�rrrt%rgrtzX<test.test_pydoc.TestDescriptions.test_custom_non_data_descriptor.<locals>.Descr object>�Custom descriptorzo<test.test_pydoc.TestDescriptions.test_custom_non_data_descriptor.<locals>.Descr object>
    Custom descriptor
rCzfoo(...)
    Custom descriptor
�rTrWr�r�rrwrr�r�test_custom_non_data_descriptorsz0TestDescriptions.test_custom_non_data_descriptorcr�)
Nc@seZdZdd�Zdd�ZdS)z;TestDescriptions.test_custom_data_descriptor.<locals>.DescrcSr�r�rr�rrrr�:r�zCTestDescriptions.test_custom_data_descriptor.<locals>.Descr.__get__cSsdddS)Nrlrrr�rrr�__set__>szCTestDescriptions.test_custom_data_descriptor.<locals>.Descr.__set__N)rrrr�r�rrrrr�9sr�cr�)z7TestDescriptions.test_custom_data_descriptor.<locals>.XNr�rr�rrrt@rgrtrr�z    Custom descriptor
rCzfoo
    Custom descriptor
r�rwrr�r�test_custom_data_descriptor7sz,TestDescriptions.test_custom_data_descriptorcCsJdtfdd�}t�tj�|��}|�d|�t���|�}|�d|�dS)NrBc�s�dS�Nrlr)Zignrrr�
coro_functionQs�z=TestDescriptions.test_async_annotation.<locals>.coro_functionzasync coro_functionz4async <a name="-coro_function"><strong>coro_function)r7r#rQr8�documentrrr-)rOr�rB�htmlrrr�test_async_annotationPs�z&TestDescriptions.test_async_annotationcCsDdd�}t�tj�|��}|�d|�t���|�}|�d|�dS)NcSs�dVdSr�rrrrr�an_async_generator]s�
zLTestDescriptions.test_async_generator_annotation.<locals>.an_async_generatorzasync an_async_generatorz>async <a name="-an_async_generator"><strong>an_async_generator)r#rQr8r�rrr-)rOr�rBr�rrr�test_async_generator_annotation\s�z0TestDescriptions.test_async_generator_annotationcCs&dd�}t���|�}|�d|�dS)NcSrnrHrrrrr�a_fn_with_https_linkiszHTestDescriptions.test_html_for_https_links.<locals>.a_fn_with_https_linkz3<a href="https://localhost/">https://localhost/</a>)r#r-r�rr)rOr�r�rrr�test_html_for_https_linkshs�z*TestDescriptions.test_html_for_https_linksN)"rrrr.r3r;r>r@rJrOrsrVrWr[rr_rarirkrlrxr}r�r�r�r�r�r�r�r�r�r�r�r�rrrrr+&s\	










	







r+c@seZdZ	dd�ZdS)�PydocServerTestcCs�dd�}tj|ddd�}|�d|jj�t��}tjj	}|j
r7t�d�|j
r4t��||kr4|��n|j
s|�
|jd�dS)NcSsd||f}|S)Nzthe URL sent was: (%s, %s)r)rUZcontent_typerBrrr�my_url_handlerysz3PydocServerTest.test_server.<locals>.my_url_handlerz0.0.0.0r)�hostname�portg{�G�z�?)r#Z
_start_serverrrZ	docserver�address�time�	monotonicr-�supportZ
SHORT_TIMEOUTZserving�sleep�stoprT�error)rOr�ZserverthreadZ	starttime�timeoutrrr�test_servervs
�zPydocServerTest.test_serverN)rrrr�rrrrr�ssr�c@seZdZ	dd�Zdd�ZdS)�PydocUrlHandlerTestcCs*tj}|�t|dd�|�t|dd�dS)Nr}rr��foobar)r#rSrL�	TypeError)rOr	rrr�test_content_type_err�sz)PydocUrlHandlerTest.test_content_type_errcCsPgd�}|���|D]
\}}|�||�qWd�dS1s!wYdS)N))r�Pydoc: Index of Modules)zget?key=r�)rhr�)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)rRrW)rOZrequestsrUrErrr�test_url_requests�s
�"�z%PydocUrlHandlerTest.test_url_requestsN)rrrr�r�rrrrr��sr�c@r�)�
TestHelpercCs|�ttjj�ttj��dSrH)rT�sortedr#r�r��keyword�kwlistr�rrr�
test_keywords�s�zTestHelper.test_keywordsN)rrrr�rrrrr��r�r�c@s�eZdZe�ejjdkd�e�eed�oe�	�d�dd���Z
e�ejjdkd�e�eed�o2e�	�d�dd���Ze�ejjdkd�e�eed�oMe�	�d�d	d
���Ze�ejjdkd�e�eed�ohe�	�d�dd���Z
d
d�ZdS)�PydocWithMetaClassesr[r\r]r^cCs�Gdd�dt�}Gdd�d|d�}tdd�tD��}t�}tj|d�}||�ttf|dd	�}|���	�}|�
||�dS)
NcseZdZ�fdd�Z�ZS)z=PydocWithMetaClasses.test_DynamicClassAttribute.<locals>.Metac�|dkrdSt��|�S)N�hamZspam��super�__getattr__rM�r�rrr���zIPydocWithMetaClasses.test_DynamicClassAttribute.<locals>.Meta.__getattr__)rrrr��
__classcell__rrr�r�Meta�sr�c@seZdZejdd��ZdS)z;PydocWithMetaClasses.test_DynamicClassAttribute.<locals>.DAcSr�)NZeggsrr�rrrr��rDz?PydocWithMetaClasses.test_DynamicClassAttribute.<locals>.DA.hamN)rrrr=�DynamicClassAttributer�rrrr�DA�sr���	metaclasscsr)z	
 |      rNrrrrrr�rzBPydocWithMetaClasses.test_DynamicClassAttribute.<locals>.<genexpr>r�r[)r�r�expected_data_docstringsrr#r��!expected_dynamicattribute_patternrr�r%rT)rOr�r�rir2r�rjrVrrr�test_DynamicClassAttribute�s��z/PydocWithMetaClasses.test_DynamicClassAttributecC�`Gdd�dt�}Gdd�d|d�}t�}tj|d�}||�tt}|����}|�||�dS)Nc�$eZdZdd�Z�fdd�Z�ZS)zHPydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.<locals>.MetacS�gd�S)N)r�rr�LIFEr�rzrrr�__dir__��zPPydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.<locals>.Meta.__dir__cr�)Nr�r|)r�Z_Meta__getattrrMr�rrr��r�zTPydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.<locals>.Meta.__getattr__�rrrr�r�r�rrr�rr���r�c@r)zIPydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.<locals>.ClassNrrrrr�Class�r�r�r�r�)	r�rr#r��"expected_virtualattribute_pattern1rr�r%rT)rOr�r�r2r�rjrVrrr�%test_virtualClassAttributeWithOneMeta�s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)Ncr�)zIPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta1cSr�)N)r�rrrmrr�rrrr��r�zQPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta1.__dir__cr�)Nrmrlr�rMr�rrr��r�zUPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta1.__getattr__r�rrr�r�Meta1�r�r�cr�)zIPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta2cSr�)N)r�rr�tworr�rrrr��r�zQPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta2.__dir__cr�)Nr�r[r�rMr�rrr��r�zUPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta2.__getattr__r�rrr�r�Meta2�r�r�cs*eZdZ��fdd�Z�fdd�Z�ZS)zIPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta3cs(tttgd���|���|����S)N)r�rr�three)r9r��setr�r��r�r�rrr��s���zQPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta3.__dir__cr�)Nr�r r�rMr�rrr��r�zUPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta3.__getattr__r�rr�r�r�Meta3�sr�c@r)zJPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Class1Nrrrrr�Class1�r�r�r�c@r)zJPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Class2Nrrrrr�Class2�r�r�Fr�)
r�rr#r��"expected_virtualattribute_pattern2rr�r%rT�"expected_virtualattribute_pattern3)rOr�r�r�Zfail1Zfail2r2r�Zexpected_text1Zresult1Zexpected_text2Zresult2rr�r�%test_virtualClassAttributeWithTwoMeta�s$	z:PydocWithMetaClasses.test_virtualClassAttributeWithTwoMetacCr�)Nc@r�)z.PydocWithMetaClasses.test_buggy_dir.<locals>.McSr�)N)r�r�missing�hererr�rrrr�r�z6PydocWithMetaClasses.test_buggy_dir.<locals>.M.__dir__N)rrrr�rrrr�Mr�r�c@r�)z.PydocWithMetaClasses.test_buggy_dir.<locals>.Czpresent!N)rrrr�rrrrr/r~r/r�r�)	r�rr#r��!expected_missingattribute_patternrr�r%rT)rOr�r/r2r�rjrVrrr�test_buggy_dirsz#PydocWithMetaClasses.test_buggy_dircCsHt��
}t�d�Wd�n1swY|��}|�d|�dS)Nz	enum.Enumz
class Enum)r	r#r�r�rr)rOr�r�rrr�test_resolve_falses
�z'PydocWithMetaClasses.test_resolve_falseN)rrrr�r�rxr�r�r�r]r�r�r�rrrrrrr��s<������*��
r�c@sFeZdZdd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�TestInternalUtilitiescCsNt��}|j|_tj�|jd�|_|�|j	�t�
�|_}dtj|g|_
dS)NZnonexistentr)�tempfile�TemporaryDirectoryrN�argv0dirr6r7r��argv0r��cleanup�getcwd�
abs_curdir�curdir�curdir_spellings)rOZtmpdirr
rrrr(szTestInternalUtilities.setUpNcCs|dur|j}t�||�SrH)rr#�_get_revised_path)rO�
given_pathrrrrr
0sz'TestInternalUtilities._get_revised_pathcCs8tj��}|jD]}t|�|��D]}|�|�qq|SrH)rxr7�copyrr��countr�)rO�
clean_path�spelling�__rrr�_get_starting_path7s

�z(TestInternalUtilities._get_starting_pathcCs*|��}|jg|}|�|�|�|�dSrH)rr
rTr
)rOr�
expected_pathrrr�,test_sys_path_adjustment_adds_missing_curdir?szBTestInternalUtilities.test_sys_path_adjustment_adds_missing_curdircCsT|��}|jg|}|jg|}|�|�|�|�||jg}|�|�|�|�dSrH)rr
rrTr
)rOrr�leading_argv0dir�trailing_argv0dirrrr�*test_sys_path_adjustment_removes_argv0_dirDsz@TestInternalUtilities.test_sys_path_adjustment_removes_argv0_dircsh�fdd�}���}�jg|}�jg|}��||�|�|�jg}�jg|}��||�|�dS)Ncs�j|tjd�S)N)r)r
r#r$)rr�rrr
NrNz\TestInternalUtilities.test_sys_path_adjustment_protects_pydoc_dir.<locals>._get_revised_path)rrr
rT)rOr
rrrrrr�r�+test_sys_path_adjustment_protects_pydoc_dirMszATestInternalUtilities.test_sys_path_adjustment_protects_pydoc_dirc	Cs�|��}|jD]N}|j|d��>|g|}|�|�|��||g}|�|�|��|jg|}|�|�|��||jg}|�|�|��Wd�n1sPwYqdS)N)Zcurdir_spelling)rrZsubTestr�r
r)rOrrZleading_curdirZtrailing_curdirrrrrr�5test_sys_path_adjustment_when_curdir_already_includedXs


���zKTestInternalUtilities.test_sys_path_adjustment_when_curdir_already_includedrH)
rrrrr
rrrrrrrrrr&s
	rcCs*t��}tjtjg|�R�t�t�dSrH)rZthreading_setupr�ZaddModuleCleanupZthreading_cleanupr)�thread_inforrr�setUpModulegsr�__main__)Rr6rxrX�importlib.utilr�r_r#r�r�r\rQr=r�stringrZtest.supportr-r�r=r5r��urllib.parseraZ	xml.etreertZxml.etree.ElementTreer��ior�collectionsrrZtest.support.script_helperrrrrr	r
rZtest.support.os_helperrr
rrrr�ZHAVE_DOCSTRINGSr�r%rhrrirdrer!�linesepr�rr�r�r�r�rr,r4r;r@rFZTestCaserGrZr�r+r�r�r�r�rrr�mainrrrr�<module>s�\�^����
���	�	��	
		ROvA
�