
    ;bhC$                       d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dlmZ d dlmZm Z  d dlm!Z! d dlm"Z" d dlm#Z# d dl$m%Z%m&Z&m'Z' d d	lm(Z( d d
lm)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0 d dl1m2Z2m3Z3m4Z4 d dl5m6Z6 d dl5m7Z7  G d d      Z8ejB                  jr                  rdZ:ndZ:djw                         Z< e=d e:D              Z>dZ? e=d e:D              Z@dj                  de j                        ZCdZDdjw                         ZEdjw                         ZFdjw                         ZGdjw                         ZHdjw                         ZId ZJd ZKd  ZLd! ZMd" ZNd# ZOd$ ZPd% ZQ G d& d'ej                        ZS G d( d)ej                        ZT G d* d+eS      ZU G d, d-ej                        ZV G d. d/ej                        ZW ej                  e-xs e.d0       G d1 d2ej                               ZY G d3 d4eS      ZZ G d5 d6ej                        Z[ G d7 d8ej                        Z\ G d9 d:ej                        Z]d; Z^e_d<k(  r ej                          yy)=    N)StringIO)
namedtuple)urlopen
urlcleanup)support)import_helper)	os_helper)assert_python_okassert_python_failurespawn_python)threading_helper)reap_childrencaptured_outputcaptured_stdoutcaptured_stderris_emscriptenis_wasirequires_docstringsMISSING_C_DOCSTRINGS)TESTFNrmtreeunlink)	pydoc_mod)pydocfodderc                       e Zd ZdZy)nonasciiu   Це не латиницяN__name__
__module____qualname____doc__     D/opt/python-3.12.12/usr/lib/python3.12/test/test_pydoc/test_pydoc.pyr   r   )   s     r#   r   )!dictionary for instance variables%list of weak references to the objectr%   r&   ) r'   r'   r'   a  
NAME
    test.test_pydoc.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)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables
     |
     |  __weakref__
     |      list of weak references to the object

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.test_pydoc.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
c              #   .   K   | ]  }|rd |z   nd  yw)z
     |      r'   Nr"   .0ss     r$   	<genexpr>r,      s'      &I/G! ?@&6&:R&G/G   a{  
test.test_pydoc.pydoc_mod (version 1.2.3.4)
This is a test module for test_pydoc

Modules
    types
    typing

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__
            dictionary for instance variables
        __weakref__
            list of weak references to the object

class B(builtins.object)
    Data descriptors defined here:
        __dict__
            dictionary for instance variables
        __weakref__
            list of weak references to the object
    ----------------------------------------------------------------------
    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)
    ----------------------------------------------------------------------
    Data descriptors defined here:
        __dict__
            dictionary for instance variables
        __weakref__
             list of weak references to the object

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.test_pydoc.pydoc_mod.C[int]
    list_alias1 = typing.List[int]
    list_alias2 = list[int]
    type_union1 = typing.Union[int, str]
    type_union2 = int | str

Author
    Benjamin Peterson

Credits
    Nobody
c              #   @   K   | ]  }|j                  d d        yw) &nbsp;N)replacer)   s     r$   r,   r,      s$      &I/G! '(iiX&>/Gs   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!'
c                 r    || fz   }t        dt        j                  g|i |\  }}}|j                         S )zW
    Runs pydoc on the specified module. Returns the stripped
    output of pydoc.
    -B)r
   pydoc__file__stripmodule_nameargsenvrcouterrs         r$   	run_pydocr?   6  s<    
 ;. D#D%..G4G3GLBS99;r#   c                 r    || fz   }t        dt        j                  g|i |\  }}}|j                         S )zA
    Runs pydoc on the specified module expecting a failure.
    r4   )r   r5   r6   r7   r8   s         r$   run_pydoc_failrA   @  s<     ;. D(u~~LLLLBS99;r#   c                     t        j                         }|j                  |       }|j                  t              xs d}|rd|z   dz   }|j                         |fS )z&Returns pydoc generated output as htmlr'   z<br><a href="z">Module Docs</a>)r5   HTMLDoc	docmodule	getdoclocr   r7   )moduledocoutputlocs       r$   get_pydoc_htmlrJ   H  sR    
--/C]]6"F
--	
"
(bC
$';;<<>3r#   c                 0    t        j                  dd|       S )Nz.r'   )resub)rG   s    r$   
clean_textrN   Q  s    66%S!!r#   c           	          t         j                  j                  }t         j                  j                  } | | | |t                                }t        j                         }|j                  | |      }|S )z,Returns a documentation web link of a module)basedir)ospathabspathdirnamer6   r5   TextDocrE   )rF   rS   rT   rP   rG   rI   s         r$   get_pydoc_linkrV   U  sW    ggooGggooGgggh&789:G
--/C
---
0CJr#   c                     t        j                         }|j                  t              xs d}|rd|z   dz   }|j	                  |       }t        |      }|j                         |fS )z&Returns pydoc generated output as textr'   z
MODULE DOCS
    r2   )r5   rU   rE   r   rD   rN   r7   )rF   rG   rI   rH   s       r$   get_pydoc_textrX   ^  s[    
--/C
--	
"
(bC
#c)D0]]6"FF<<>3r#   c                     | j                  d      \  }}}|j                  d      \  }}}|j                  d      \  }}}|S )Nz</head>z<title>z</title>)	partition)textheader_titles       r$   get_html_titler_   i  sE    >>),LFAq""9-KAq%//*-KE1aLr#   c           	          | j                  dd      } | j                  dd      } t        j                  dd|       } t        j                   | ddd	d
dd      } | S )zWA quick and dirty implementation of html2text.

    Tailored for pydoc tests only.
    z<dd>r2   z<hr>F----------------------------------------------------------------------z<.*?>r'   r0   r/   z&gt;>z&lt;<)r1   rL   rM   r5   )htmls    r$   	html2textre   q  sU    
 <<%D<<'D66'2t$D==xfc63GDKr#   c                   F    e Zd Zd ZddZej                  dd       Zd Zy)PydocBaseTestc                 R    | j                  t        j                  d   t               y Nr5   assertIssysmodulesr5   selfs    r$   tearDownzPydocBaseTest.tearDown~  s     	ckk'*E2r#   Nc                 h    |xs$ t         j                  j                  t              gdfd	}|S )zi
        A version of pkgutil.walk_packages() that will restrict itself to
        a given path.
        c                       | xs ||      S Nr"   )rR   prefixonerrordefault_pathwalk_packagess      r$   wrapperz8PydocBaseTest._restricted_walk_packages.<locals>.wrapper  s     !5vwGGr#   )Nr'   N)rQ   rR   rT   r6   )ro   rw   rR   rx   rv   s    `  @r$   _restricted_walk_packagesz'PydocBaseTest._restricted_walk_packages  s*    
 : 9:	Hr#   c              #      K   t         j                  }| j                  ||      t         _        	 d  |t         _        y # |t         _        w xY wwrs   )pkgutilrw   ry   )ro   rR   rw   s      r$   restrict_walk_packagesz$PydocBaseTest.restrict_walk_packages  sB     -- $ > >}?C!E	2$1G!MG!s   ,A? AAAc                 n    t        j                  |d      }t        |      }| j                  |||       |S )Nz	text/html)r5   _url_handlerr_   assertEqual)ro   urlexpected_titler[   results        r$   call_url_handlerzPydocBaseTest.call_url_handler  s5    !!#{3%6r#   rs   )	r   r   r    rp   ry   
contextlibcontextmanagerr|   r   r"   r#   r$   rg   rg   }  s+    3 2 2r#   rg   c                       e Zd ZdZd Z ej                   eed      xr  ej                         d      e
d               Z ej                   eed      xr  ej                         d      e
d               Zd Zd Zd	 Zd
 Zd Zd Ze
d        Zd Zd Zd Zd Zd Zd Zd Zd Zd Z ej                   eed      xr  ej                         d      ej:                  j=                  d      e
d                      Z ej                   eed      xr  ej                         d      e
ej:                  j=                  d      d                      Z d Z!d Z"ej:                  j=                  d      d        Z# ej                   eed      xr  ej                         d      e
ej:                  j=                  d      d                      Z$d Z%d Z&d  Z'd! Z(d" Z)d# Z*d$ Z+e
d%        Z,d& Z-d' Z.d( Z/d) Z0d* Z1e
d+        Z2d, Z3y)-PydocDocTestNc                 R    | j                  t        j                  d   t               y ri   rj   rn   s    r$   rp   zPydocDocTest.tearDown      ckk'*E2r#   gettrace1trace function introduces __locals__ unexpectedlyc                 D   t        t              \  }}t        |      }|j                         D cg c]  }|j	                          }}|D cg c]  }|s|	 }}|d= t
        j                         }|D cg c]  }|s|j	                          }}| j                  ||       t        j                  t              }t        j                  j                  |      }| j                  ||       | j                  ||       | j                  ||       y c c}w c c}w c c}w N   )rJ   r   re   
splitlinesr7   html2text_of_expectedr   inspect
getabsfileurllibparsequoteassertIn)	ro   r   doc_loctext_resultline
text_linesexpected_linesmod_filemod_urls	            r$   test_html_doczPydocDocTest.test_html_doc  s     )3'/:/E/E/GH/Gtdjjl/G
H'1:ztTdz
:qM.99;3AJ>4T$**,>J^4%%i0,,$$X.gv&h'gv& I: Ks   DDD6D>Dc                     t        t              \  }}t        |ft        z   t	        j
                  t              fz   z  }| j                  ||       y rs   )rX   r   expected_text_patternexpected_text_data_docstringsr   r   r   )ro   r   r   expected_texts       r$   test_text_doczPydocDocTest.test_text_doc  sQ     )3- 
56 ++I689: 	/r#   c                     dd l } G d d|j                        }t        j                  |      }| j	                  d|       y )Nr   c                       e Zd ZdZdZy)IPydocDocTest.test_text_enum_member_with_value_zero.<locals>.BinaryIntegerr   r   N)r   r   r    zerooner"   r#   r$   BinaryIntegerr     s    DCr#   r   zBinaryInteger.zero)enumIntEnumr5   
render_docr   )ro   r   r   rG   s       r$   %test_text_enum_member_with_value_zeroz2PydocDocTest.test_text_enum_member_with_value_zero  s8     		DLL 	 }-*C0r#   c                 n    t        t        j                  j                        }| j	                  d|       y )Nzxml.etree.elementtree)rV   xmletreeElementTreer   )ro   doc_links     r$   ,test_mixed_case_module_names_are_lower_casedz9PydocDocTest.test_mixed_case_module_names_are_lower_cased  s%    !#))"7"78-x8r#   c                 b    t        t        j                        \  }}| j                  |dd       y )Nr'   z'MODULE DOCS incorrectly includes a link)rX   r   r   r   )ro   r   r   s      r$   test_issue8225zPydocDocTest.test_issue8225  s'    (3"&OPr#   c                     t         j                  }	 d t         _        t        j                          |t         _        y # |t         _        w xY wrs   )rl   stdinr5   getpager)ro   previous_stdins     r$   test_getpager_with_stdin_nonez*PydocDocTest.test_getpager_with_stdin_none  s0    	'CINN&CICIs	   = A
c                      G d d      } G d d      }t        j                   |             }t        j                   |             }| j                  |j                  dd      |       y )Nc                       e Zd ZdZ y))PydocDocTest.test_non_str_name.<locals>.A*   Nr   r   r    r"   r#   r$   Ar     s    Hr#   r   c                       e Zd Zy))PydocDocTest.test_non_str_name.<locals>.BNr   r"   r#   r$   Br         r#   r   )r5   r   r   r1   )ro   r   r   adocbdocs        r$   test_non_str_namezPydocDocTest.test_non_str_name  sU    	 		 	$$c3/6r#   c                 j    d}t        t        |      d      }t        |z  }| j                  ||d       y )Ntest.i_am_not_hereasciiz&documentation for missing module found)strrA   missing_patternr   ro   missing_moduler   expecteds       r$   test_not_herezPydocDocTest.test_not_here  s7    -^N3W="^364	6r#   c                     t        dd      }t        j                  j                  dd      }| j	                  ||       y )Nz#test.test_pydoc.test_pydoc.nonasciir   )PYTHONIOENCODINGbackslashreplace)r?   r   r!   encoder   )ro   r   encodeds      r$   test_not_asciizPydocDocTest.test_not_ascii  s7    @SZ[""))'3EFgv&r#   c                     d}t        t        |      d      }t        |j                         z  }| j	                  ||       y )Nz test.i_am_not_here r   )r   rA   r   r7   r   r   s       r$   test_input_stripzPydocDocTest.test_input_strip  s;    /^N3W="^%9%9%;;6*r#   c                     t         j                  }| j                   |d      d       | j                   |d      d       | j                   |d      d       | j                   |d      d       y )Nz<function stripid at 0x88dcee4>z<function stripid>z <function stripid at 0x01F65390>42z<type 'exceptions.Exception'>)r5   stripidr   )ro   r   s     r$   test_stripidzPydocDocTest.test_stripid  sl    --!BC-	/!CD-	/ 	-!@A8	:r#   c                 ~    t        j                         }|j                  t              }d}| j	                  ||       y)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)r5   rU   docclassobjectassertRegexro   rG   r[   snips       r$   )test_builtin_with_more_than_four_childrenz6PydocDocTest.test_builtin_with_more_than_four_children
  s6    * mmo||F#8 	t$r#   c                 ~    t        j                         }|j                  t              }d}| j	                  ||       y)a1  Tests 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)r5   rU   r   ArithmeticErrorr   r   s       r$   test_builtin_with_childz$PydocDocTest.test_builtin_with_child)  s4    & mmo||O,, 	dD!r#   c                     t        j                         }|j                  t              }d}| j	                  ||       | j                  d|       y)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)r5   rU   r   	Exceptionr   assertNotInr   s       r$   test_builtin_with_grandchildz)PydocDocTest.test_builtin_with_grandchildD  sE    , mmo||I&) 	dD!,d3r#   c                 z    t        j                         }|j                  t              }| j	                  d|       y)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)r5   rU   r   r   r   ro   rG   r[   s      r$   test_builtin_no_childz"PydocDocTest.test_builtin_no_childd  s/    . mmo||-..5r#   c                 z    t        j                         }|j                  t              }| j	                  d|       y)zTests help on metaclasses.

        When running help() on a metaclasses such as type, it
        should not contain any "Built-in subclasses" section.
        r   N)r5   rU   r   typer   r   s      r$   test_builtin_on_metaclassesz(PydocDocTest.test_builtin_on_metaclasses  s.     mmo||D!.5r#   c                 .   t         dz  j                         }t        d      5 }|j                  d      \  }}|j	                         j                         dd }|d   j                  d      |d<   | j                  ||       d d d        y # 1 sw Y   y xY w)Nabdz-chelp()s   abdiir   zhelp> )r   r   r   communicatedecoderemoveprefixr   )ro   elinesprocr=   r]   oliness         r$   test_fail_help_clizPydocDocTest.test_fail_help_cli  s    !E)557-(D%%f-FCZZ\,,.r"5Fq	..x8F1IVV,	 )((s   ABBc                 :   t               5 }t        j                  |      }|j                  d       t        dz  }| j                  ||j                         j                         j                  dt        j                               d d d        y # 1 sw Y   y xY w)NrH   r   r2   )r   r5   Helperhelpr   r   getvaluer7   r1   rQ   linesep)ro   bufhelperr   s       r$   test_fail_help_output_redirectz+PydocDocTest.test_fail_help_output_redirect  sg    Z3\\-FKK&.HXs||~';';'='E'EdBJJ'WX	 ZZs   A=BBzpydoc.pagerc                    d | _         t        t              \  }}d}dj                         }t	        j
                  |      }|t        z   }t        d      5 }t        d      5 }t               5 }	t        j                  |	      }
|
j                  |       |	j                         j                         }||ft        z   t        j                   t              fz   z  }| j#                  d|j                                | j#                  d|j                                | j#                  ||       d d d        d d d        d d d        |j%                          y # 1 sw Y   *xY w# 1 sw Y   .xY w# 1 sw Y   2xY w)Nztest.test_pydoc.pydoc_modzO
        Help on module test.test_pydoc.pydoc_mod in test.test_pydoc:

        stdoutstderrr   r'   )maxDiffrX   r   lstriptextwrapdedentr   r   r   r5   r   r   r   r7   r   r   r   r   assert_not_called)ro   
pager_mockunusedr   rF   help_headerexpected_help_patternrH   r>   r  r  r   r   s                r$   test_help_output_redirectz&PydocDocTest.test_help_output_redirect  s9    (3, FH 	 ook2 +.C CX&&X&#Z3\\-FKK\\^))+F1$J9:$//	:<=>M R!23R0]F3  ' ' 	$$& Z '& '&s=   E-!E!,C E,E!4E-EE!!E*	&E--E6c                      fd}d  _          |dd        |dd        |dd        |dd	        |d
d        |dd        |dd        |dd        |dd        |dd        |t        j                  j                  d       y )Nc           
      6   t        d      5 }t        d      5 }t               5 }t        j                  |      }|j	                  |        |j                         j                         }j                  d|j                         d|  d       j                  d|j                         d|  d       j                  ||d|  d       j                          ddd       ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   yxY w)	z7Helper function to run pydoc with its output redirectedr  r  r   r'   zfailed on request "")msgN)
r   r   r5   r   r   r   r7   r   r   r  )	requestexpected_text_partrH   r>   r  r  r   r  ro   s	          r$   run_pydoc_for_requestzVPydocDocTest.test_help_output_redirect_various_requests.<locals>.run_pydoc_for_request  s     *f *csS1G$--/  V__%6>QRYQZZ[<\ ]  S\\^;NwiWX9Y Z0&@ST[S\\]>^_,,.  + +* +* +*s:   DDB:C7D&D7D <DD	DDkeywordsz&Here is a list of the Python keywords.symbolsz)Here is a list of the punctuation symbolstopicsz#Here is a list of available topics.%zThe power operatorTruezclass bool(int)FalseNonezclass NoneType(object)assertzThe "assert" statementTYPESzThe standard type hierarchyzpydoc.Helper.helpz&Help on function help in pydoc.Helper:z&Help on function help in module pydoc:)r  r5   r   r   )ro   r  r  s   `` r$   *test_help_output_redirect_various_requestsz7PydocDocTest.test_help_output_redirect_various_requests  s    	/  	j*RSi)TUh(MN 	c#78f&78g'89f&>?h(@Ag'DE13[\ell//1YZr#   c                     t               5 }t        j                         }|j                  d       d d d        j	                         }| j                  d|       y # 1 sw Y   ,xY w)NwithThe "with" statement)r   r5   r   	showtopicr   r   )ro   showtopic_ior  helptexts       r$   test_showtopiczPydocDocTest.test_showtopic  sP    ,\\^FV$   ((*,h7	 s   &AA%c                     t               5 }t        j                         }|j                  d       d}| j	                  ||j                         j                                d d d        y # 1 sw Y   y xY w)Nr    no documentation found for 'abd')r   r5   r   r&  r   r   r7   )ro   r'  r  r   s       r$   test_fail_showtopicz PydocDocTest.test_fail_showtopic  sV    ,\\^FU#9HX|'<'<'>'D'D'FG	 s   AA**A3c                    t               5 }t        j                  |      }|j                  d       d}| j	                  ||j                         j                                d d d        |j                          y # 1 sw Y   xY w)Nr   r   r+  )r   r5   r   r&  r   r   r7   r  )ro   r  r  r  r   s        r$   #test_fail_showtopic_output_redirectz0PydocDocTest.test_fail_showtopic_output_redirect  sd    Z3\\-FU#9HXs||~';';'=>	  	$$& Zs   AA<<Bc                    d | _         t        d      5 }t        d      5 }t               5 }t        j                  |      }|j                  d       |j                         j                         }| j                  d|j                                | j                  d|j                                | j                  d|       d d d        d d d        d d d        |j                          y # 1 sw Y   *xY w# 1 sw Y   .xY w# 1 sw Y   2xY w)Nr  r  r   r$  r'   r%  )r  r   r   r5   r   r&  r   r7   r   r   r  )ro   r  rH   r>   r  r  r   s          r$   test_showtopic_output_redirectz+PydocDocTest.test_showtopic_output_redirect  s     X&&X&#Z3\\-FV$\\^))+FR!23R0MM0&9  ' ' 	$$& Z '& '&s:   DC7BC+C7
D+C40C77D 	<DDc                     d }dt         i|_        t        d      5 }t        j                  |       d d d        j                         }| j                  d|       y # 1 sw Y   ,xY w)Nc                      yr   r"   abcs      r$   <lambda>zAPydocDocTest.test_lambda_with_return_annotation.<locals>.<lambda>      qr#   returnr  zlambda (a, b, c) -> intint__annotations__r   r5   r   r   r   ro   funchelp_ior(  s       r$   "test_lambda_with_return_annotationz/PydocDocTest.test_lambda_with_return_annotation  sT      (#X&'JJt '##%/: '&s   AA&c                     d }t         t         t         d|_        t        d      5 }t        j                  |       d d d        j                         }| j                  d|       y # 1 sw Y   ,xY w)Nc                      yr   r"   r3  s      r$   r7  zDPydocDocTest.test_lambda_without_return_annotation.<locals>.<lambda>   r8  r#   r3  r  zlambda (a: int, b: int, c: int)r:  r=  s       r$   %test_lambda_without_return_annotationz2PydocDocTest.test_lambda_without_return_annotation  sW     %(s=X&'JJt '##%7B '&s   A''A0c                     d }t         t         t         t         d|_        t        d      5 }t        j                  |       d d d        j                         }| j                  d|       y # 1 sw Y   ,xY w)Nc                      yr   r"   r3  s      r$   r7  zLPydocDocTest.test_lambda_with_return_and_params_annotation.<locals>.<lambda>(  r8  r#   )r4  r5  r6  r9  r  z&lambda (a: int, b: int, c: int) -> intr:  r=  s       r$   -test_lambda_with_return_and_params_annotationz:PydocDocTest.test_lambda_with_return_and_params_annotation'  sY     %(sLX&'JJt '##%>I '&s   A,,A5c                 8   t        dddg      }t               5 }t        j                  |       d d d        j	                         }| j                  d|       | j                  d|       | j                  d|       | j                  d|       y # 1 sw Y   bxY w)NPersonnickname	firstnamezAlias for field number 0zAlias for field number 1r   r   r5   r   r   r   )ro   rH  r?  r(  s       r$   test_namedtuple_fieldsz#PydocDocTest.test_namedtuple_fields/  s}    Hz;&?@'JJv ##%j(+k8,0(;0(; s   BBc                    t        dddgd      }t               5 }t        j                  |       d d d        j	                         }| j                  d|       | j                  d|       | j                  d|       y # 1 sw Y   PxY w)	NNTabcdefT)rename_1_replace_asdictrK  )ro   rN  r?  r(  s       r$   !test_namedtuple_public_underscorez.PydocDocTest.test_namedtuple_public_underscore9  sm    uenT:'JJrN ##%dH%j(+i* s   B  B	c                 b   | j                  t        t               dD ]  }t        t        d|      5 }|dk7  rt	        dj                  |      |       t	        d|       t	        d|       d d d        t        j                  t        i       }| j                  |d	        y # 1 sw Y   8xY w)
N)z
ISO-8859-1UTF-8wencodingrW  z#coding: {})fileu   """line 1: hézline 2: hi"""u   line 1: hé)	
addCleanupr   r   openprintformatr5   synopsisr   )ro   rZ  scriptr`  s       r$   test_synopsiszPydocDocTest.test_synopsisB  s    '/HfcH5w&-..x8vF(v6oF3	 6
 ~~fb1HX7 055s   <B%%B.	c                 .    d7 fd	} |dd        |dd        |dd        |dd        |d	d         |d
d        |dd        |dd        |dd        |dd         |dd         |dd         |dd        |dd        |dd        |dd        |dd        |dd        |dd         |d d!        |d"d         |d#d         |d$d%        |d&d         |d'd(        |d)d*        |d+d         |d,d-d./        |d0d d1/       t        j                  d2d13      5 }|j                  d4       |j                          |j	                  d5       t        j                  |      } j                  |d6       d d d        y # 1 sw Y   y xY w)8Nc                    t        | t              rt        |       }n*t        j                  t        j
                  |       |      }|5  t        j                  |      }j                  ||       d d d        y # 1 sw Y   y xY w)NrY  )	
isinstancer   r   ioTextIOWrapperBytesIOr5   source_synopsisr   )sourcer   rZ  source_filer   ro   s        r$   checkz0PydocDocTest.test_source_synopsis.<locals>.checkN  s_    &#&&v. ..rzz&/AHU..{;  2 s   
(A;;Bz"""Single line docstring."""zSingle line docstring.z7"""First line of docstring.
Second line.
Third line."""zFirst line of docstring.z9"""First line of docstring.\nSecond line.\nThird line."""z&"""  Whitespace around docstring.  """zWhitespace around docstring.zimport sys
"""No docstring"""z$  
"""Docstring after empty line."""zDocstring after empty line.z(# Comment
"""Docstring after comment."""zDocstring after comment.z3  # Indented comment
"""Docstring after comment."""z""""""r'   z"""Embedded null byte"""z"""Embedded null byte""" u   """Café and résumé."""u   Café and résumé.z'''Triple single quotes'''zTriple single quotesz"Single double quotes"zSingle double quotesz'Single single quotes'zSingle single quotesz"""split\
line"""	splitlinez#"""Unrecognized escape \sequence"""zUnrecognized escape \sequencez"""Invalid escape seq\uence"""zr"""Raw \stri\ng"""zRaw \stri\ngzb"""Bytes literal"""zf"""f-string"""z("""Concatenated""" \
"string" 'literals'Concatenatedstringliteralsz"""String""" + """expression"""z("""In parentheses""")zIn parenthesesz,("""Multiple lines """
"""in parentheses""")zMultiple lines in parenthesesz()s%   # coding: iso-8859-15
"""uro sign"""u   €uro signziso-8859-15rY  s   """"""zutf-8zw+)moderZ  z"""Real file test."""
r   zReal file test.rs   )tempfileNamedTemporaryFilewriteflushseekr5   ri  r   )ro   rl  	temp_filer   s   `   r$   test_source_synopsisz!PydocDocTest.test_source_synopsisM  s   	3 	,&	(I(	*K(	*6,	..	5+	-9(	*D(	*h	b	)	*	)#	%*$	&&$	&&$	&#	4.	0/	%	 $		<*	,/	&	 =-	/d	:m	5mW	& ((dWEOO56OONN1**95FV%67 FEEs   (AFFc                     t        j                  d      }|j                  j                         d   }|j                  j
                  }t        j                  |      }| j                  ||       y )NrQ   r   )	r   import_fresh_moduler!   r   __spec__cachedr5   r`  r   )ro   rQ   r   filenamer`  s        r$   test_synopsis_sourcelessz%PydocDocTest.test_synopsis_sourceless  sV    ..t4::((*1-;;%%>>(+8,r#   c                    t        j                         5 }t        j                  j	                  |d      }t
        j                  j                  |      }t        |d      5 }|j                  d       d d d        t        j                  |       t        j                  |i       }| j                  |       t        j                  |i       }| j                  |       d d d        y # 1 sw Y   uxY w# 1 sw Y   y xY w)Nzfoomod42.pyrX  foo = 1)r	   temp_cwdrQ   rR   join	importlibutilcache_from_sourcer]  rr  
py_compilecompiler5   r`  assertIsNone)ro   test_dir	init_pathcached_pathfobjr`  synopsis_cacheds          r$   "test_synopsis_sourceless_empty_docz/PydocDocTest.test_synopsis_sourceless_empty_doc  s    !XX}=I#..::9EKi%

9% &y)~~i4Hh'#nn["=Oo. "! &% "!s%   AC3!C'3A+C3'C0	,C33C<c                 R    d}| j                  t        j                  |      d       y )Nz#I Am A Doc


Here is my description)z
I Am A Docz
Here is my description)r   r5   splitdoc)ro   example_strings     r$   test_splitdoc_with_descriptionz+PydocDocTest.test_splitdoc_with_description  s$    A7C	Er#   c                     t        j                         5 }| j                  t        j                  |             d d d        y # 1 sw Y   y xY wrs   )r	   r  assertFalser5   	ispackage)ro   r  s     r$    test_is_package_when_not_packagez-PydocDocTest.test_is_package_when_not_package  s3    !XU__X67 "!!s   %AAc                 <   t        j                         5 }t        j                  j	                  |d      }t        |d      j                          | j                  t        j                  |             t        j                  |       d d d        y # 1 sw Y   y xY w)N__init__.pyrX  )r	   r  rQ   rR   r  r]  close
assertTruer5   r  remove)ro   r  r  s      r$   test_is_package_when_is_packagez,PydocDocTest.test_is_package_when_is_package  sd    !XX}=IC &&(OOEOOH56IIi 	 "!!s   A4BBc                     G d dt               }t        t        t                     }|j                  |d<   |d= |d= |j                  |d<   |j
                  |d<   t        j                  |      }| j                  ||       y )Nc                       e Zd Zd Zy)/PydocDocTest.test_allmethods.<locals>.TestClassc                      y)NTr"   rn   s    r$   method_returning_truezEPydocDocTest.test_allmethods.<locals>.TestClass.method_returning_true  s    r#   N)r   r   r    r  r"   r#   r$   	TestClassr    s    r#   r  r  r!   	__class____subclasshook____init_subclass__)	r   dictvarsr  r  r  r5   
allmethodsassertDictEqual)ro   r  r   methodss       r$   test_allmethodszPydocDocTest.test_allmethods  s    	 	
 V%,5,K,K()Y[! (1'A'A#$(1(C(C$%""9-Wh/r#   c                     G d d       G fdd      }t        j                  |      }t        |      }| j                  |dt        z         t        j                  |t        j
                               }dt         d}t        |      }|j                  d	      D cg c]  }|s|j                          }}|D ]  }| j                  ||        y c c}w )
Nc                       e Zd ZddZeZd Zy)+PydocDocTest.test_method_aliases.<locals>.ANc                      y)z(Raise this widget in the stacking order.Nr"   )ro   	aboveThiss     r$   tkraisez3PydocDocTest.test_method_aliases.<locals>.A.tkraise      r#   c                      y)zReturn sizeNr"   rn   s    r$   a_sizez2PydocDocTest.test_method_aliases.<locals>.A.a_size  r  r#   rs   )r   r   r    r  liftr  r"   r#   r$   r   r    s    ?D"r#   r   c                   4    e Zd ZddZeZW  j
                  Zy)+PydocDocTest.test_method_aliases.<locals>.BNc                      y)z'Configure resources of an item TAGORID.Nr"   )ro   tagOrIdcnfkws       r$   itemconfigurez9PydocDocTest.test_method_aliases.<locals>.B.itemconfigure  r  r#   rs   )r   r   r    r  
itemconfigr  b_size)r   s   r$   r   r    s    >&JXXFr#   r   am  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
 |
 |  __weakref__
 |      list of weak references to the object
rendererz1
Python Library Documentation

class B in module a  
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
        __weakref__
            list of weak references to the object
r2   )
r5   r   rN   r   r   rC   re   splitr7   r   )	ro   r   rG   r   as_textr   r   expected_liner   s	           @r$   test_method_aliasesz PydocDocTest.test_method_aliases  s    	" 	"	 	 q!o %J K% %	N q5==?; * : C.3@3F3Ft3LU3L4PT$**,3LU+MMM-1 , Vs   #C+Cc                 T   dd l }t        |      \  }}t        |      \  }}t        t              \  }}t        t              \  }}|j                  D ]U  }| d}d| d}	| j                  ||       | j                  |	|       | j                  ||       | j                  |	|       W y )Nr   z = _Featurez<strong>z</strong> = _Feature)
__future__rX   rJ   r   all_feature_namesr   r   )
ro   r  future_textr]   future_htmlpydoc_mod_textpydoc_mod_htmlfeaturetxtrd   s
             r$   test__future__importsz"PydocDocTest.test__future__imports1  s     	'
3Q'
3Q*95*95!33GI[)CgY&:;DMM#{+MM$,S.1T>2 4r#   )4r   r   r    r  rp   unittestskipIfhasattrrl   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  mockpatchr  r"  r)  r,  r.  r0  r@  rC  rF  rL  rU  rb  rv  r|  r  r  r  r  r  r  r  r"   r#   r$   r   r     s   G3 X__WS*-@,#,,.HJ' J' X__WS*-@,#,,.HJ0 J019
Q
'
76 ' '
+:%>"64@68	6-Y X__WS*-@,#,,.HJ]]''  (J'< X__WS*-@,#,,.HJ]]''[ ( J'[T8H ]]'' (' X__WS*-@,#,,.HJ]]'' ( J'";CJ<+	8J8X - -
/E
8!02 W2 W2r3r#   r   c                      e Zd Zd Zd Zd Zd Zej                   e	j                  ed      d               Zd Z e	j                  d      d	        Z e	j                  d      d
        Z e	j                  d      d        Zd Zy)PydocImportTestc                     t        j                  t              | _        | j	                  t
        t               t        j                          y rs   )rQ   mkdirr   r  r\  r   r  invalidate_cachesrn   s    r$   setUpzPydocImportTest.setUpE  s,    ('##%r#   c                    d}ddddj                  |      dfdj                  |      dj                  |      ff}t        j                  j                  t        |      t        j
                  z   dz   }|D ]w  \  }}t        |d	      5 }|j                  d
j                  |             d d d        t        |t              j                  d      }t        ||fz  }| j                  ||       y y # 1 sw Y   IxY w)Ntestmod_xyzzy)i_am_not_herer  )test.i_am_not_here_eitherr  )ztest.i_am_not_here.neither_am_ir   zi_am_not_here.{}r  ztest.{}pyrX  z
import {}
)
PYTHONPATHr   )r_  rQ   rR   r  r   extsepr]  rr  rA   r   badimport_patternr   )	ro   modname	testpairssourcefnimportstringexpectedinmsgfr   r   s	            r$   test_badimportzPydocImportTest.test_badimportJ  s     ".FE&&w/Ag&	(8(8(AB	 77<<0299<tC+4'L-h$,,\:; %#G?FFwOF(G]+CCHXv. ,5$$s   !C00C9	c                    t         j                  j                  t        d      }t        j                  |       t         j                  j                  |d      t         j
                  z   dz   }t        |d      5 }|j                  d       d d d        | j                  t        g      5  t               5 }t               5 }t        j                  d       d d d        d d d        | j                  j                         d       | j                  j                         d       t               5 }t               5 }t        j                  d       d d d        d d d        | j                  |j                         j                         d       | j                  |j                         d       d d d        y # 1 sw Y   /xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)	N	syntaxerr__init__r  rX  zinvalid python syntax = $1
rR   xyzzyr'   )rQ   rR   r  r   r  r  r]  rr  r|   r   r   r5   aproposr   r   r7   )ro   pkgdir	badsyntaxr  r=   r>   s         r$   test_apropos_with_bad_packagez-PydocImportTest.test_apropos_with_bad_package_  sd   fk2
GGLL4ryy@4G	)S!QGG23 "((vh(7 "c$&#MM'* ' # S\\^R0S\\^R0 "c$&#MM+. ' # S\\^113[AS\\^R0 87 "! '& #" '& #" 87sz   :F9+G66GGGAG61G*<GG*AG69GGGG	G6G'#G**G3	/G66G?c                 h   t         j                  j                  t        d      | _        t        j
                  | j                  d       | j                  t         j                  | j                         | j                  t        g      5  t               5 }t               5 }t        j                  d       d d d        d d d        d d d        | j                  j                         d       | j                  j                         d       y # 1 sw Y   ZxY w# 1 sw Y   ^xY w# 1 sw Y   bxY w)N
unreadabler   r  SOMEKEYr'   )rQ   rR   r  r   unreadable_dirr  r\  rmdirr|   r   r   r5   r  r   r   )ro   r=   r>   s      r$    test_apropos_with_unreadable_dirz0PydocImportTest.test_apropos_with_unreadable_dirt  s     ggll6<@
$$a($"5"56 ((vh(7 "c$&#MM), ' # 8
 	,,	 '& #" 87s<   D(D!D7D?D(DDD%	!D((D1zcannot remove x bitc                 ^   t         j                  j                  t        d      }t        j                  |       | j                  t        |       t         j                  j                  |d      }t        |d      5 }|j                  d       d d d        t        j                  t        j                  |      j                        }	 t        j                  ||t        j                   z         | j                  t        g      5  t               5 }t!        j"                  d       d d d        d d d        | j%                  dj'                                t        j                  ||       y # 1 sw Y   xY w# 1 sw Y   TxY w# 1 sw Y   XxY w# t        j                  ||       w xY w)Nwalkpkgr  rX  r~  r  r'   )rQ   rR   r  r   r  r\  r   r]  rr  statS_IMODEst_modechmodS_IEXECr|   r   r5   r  r   r   )ro   r  r  r  current_moder  s         r$   test_apropos_empty_docz&PydocImportTest.test_apropos_empty_doc  s    fi0
'GGLL7	)S!TJJy! "||BGGFO$;$;<	+HHV\T\\M9:,,6(,;_=NRXb! >O;MM)V__%67HHV\* "!
 >O=N;; HHV\*sH   <E0	?F FE<)F1(F 0E9<F	FFF F,c                    t         j                  j                  t        d      }t        j                  |       t         j                  j                  |d      }t        |dd      5 }|j                  d       d d d        | j                  t        g      5  t        t        j                        }t        j                  j                  dt               	 | j                  t        d	      5  dd l}d d d        | j                  d
d      }d}| j                  ||       |t        j                  d d  	 d d d        y # 1 sw Y   xY w# 1 sw Y   XxY w# |t        j                  d d  w xY w# 1 sw Y   y xY w)Ntest_error_packager  wtr   rY  zraise ValueError("ouch")
r  r   ouchzsearch?key=test_error_packagePydoc: Search Resultsz8<a href="test_error_package.html">test_error_package</a>)rQ   rR   r  r   r  r]  rr  r|   tuplerl   insertassertRaisesRegex
ValueErrorr   r   r   )ro   r  initr  saved_pathsr   r[   founds           r$   test_url_search_package_errorz-PydocImportTest.test_url_search_package_error  s   f&:;
ww||FM2$w/1GG45 0((vh(7/KHHOOAv&
*++J?- @ ,,-L+--eT*) 87 0/ @? * 87sH   (D>>E.E.E
3.E!E.>E
E	EE++E..E7z(causes undesirable side-effects (#20128)c                    d}d}d}||z   |z   }t               }t        j                  |      } |d       |j                         j	                         }t        |j                               }| j                  ||       y )N         r   rm   )r   r5   r   r   r7   lenr   assertGreaterEqual)	ro   num_header_linesnum_module_lines_minnum_footer_linesr   rH   r  r   	num_liness	            r$   test_moduleszPydocImportTest.test_modules  s|      #&::=MMV,y"((*))+,		84r#   c                     d}t               }t        j                  |      }t               5 } |d       d d d        j	                         }| j                  ||       y # 1 sw Y   ,xY w)Nzpydoc - r   zmodules pydoc)r   r5   r   r   r   r   ro   r   rH   r  r?  r   s         r$   test_modules_searchz#PydocImportTest.test_modules_search  sX     V,'?# !!#h'	 s   	A!!A*z+some buildbots are not cooperating (#20128)c                     d}t               }t        j                  |      }t               5 } |d       d d d        j	                         }| j                  |j                  |             y # 1 sw Y   :xY w)Nzgc - r   zmodules garbage)r   r5   r   r   r   r  
startswithr  s         r$   test_modules_search_builtinz+PydocImportTest.test_modules_search_builtin  s`    V,'$% !!#))(34	 s   	A//A8c                    	 t        j                  t         j                        }| j                  |t                | j	                  |j
                  d       | j	                  |j                  t         j                         | j	                  |j                  t         j                         t         t        j                  d<   y # t         t        j                  d<   w xY wri   )	r5   
importfiler6   assertIsNotr   r   ry  rl   rm   )ro   loaded_pydocs     r$   test_importfilezPydocImportTest.test_importfile  s    	) ++ENN;L\51\22G<\22ENNC\22ENNC#(CKK 5CKK s   B)C CN)r   r   r    r  r  r  r  r	   skip_unless_working_chmodr  r  r   r  r  skipr  r  r  r!  r"   r#   r$   r  r  C  s    &
/*1*- ((X__]$9:+ ; )+ *. X]]=>5 ?5 X]]=>
( ?
( X]]@A	5 B	5	)r#   r  c                   |   e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
ed	        Zed
        Zd Zed        Zd Zd Zed        Zed        Zd Zd Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Z ed        Z!d Z"d Z#ed         Z$d! Z%y")#TestDescriptionsc                 R    | j                  t        j                  d   t               y ri   rj   rn   s    r$   rp   zTestDescriptions.tearDown  r   r#   c                 Z    t        j                  t              }| j                  d|       y )Nr   )r5   r   r   r   ro   rG   s     r$   test_modulezTestDescriptions.test_module  s     {+mS)r#   c                     G d d      } |       }| j                  t        j                  |      d       | j                  t        j                  |      d       dt        z  }| j	                  |t        j
                  |             y )Nc                       e Zd ZdZy)&TestDescriptions.test_class.<locals>.CzNew-style classNr   r"   r#   r$   Cr,    s    "r#   r-  zclass CzC in module %s object)r   r5   describer   r   r   )ro   r-  r6  r   s       r$   
test_classzTestDescriptions.test_class  sd    ""C*I6*C0*X5h 0 0 34r#   c                 R   | j                  t        j                  t        j                  t
                 d       t        j                  t        j                  t
           t        j                        }| j                  d|       | j                  d|       t        s?| j                  t        j                  j                         j                         d   |       | j                  t        j                  t        t
                 d       t        j                  t        t
           t        j                        }| j                  d|       | j                  d|       t        s@| j                  t        j                  j                         j                         d   |       y y )	N_GenericAliasr  z_GenericAlias in module typingzList = class list(object)r   GenericAliaszGenericAlias in module builtinsz
class list(object))r   r5   r.  typingListr;  r   	plaintextr   r   listr!   r7   r   r(  s     r$   test_generic_aliasz#TestDescriptions.test_generic_alias  s   C(89?Kv{{3/%//J6<137#MM$,,,,.99;A>DS	2NCtCy5??C7=,c2#MM$,,,,.99;A>D $r#   c                    | j                  t        j                  t        j                  t
        t        f         d       t        j                  t        j                  t
        t        f   t        j                        }| j                  d|       | j                  d|       t        j                  j                  rI| j                  t        j                  j                  j                         j                         d   |       | j                  t        j                  t
        t        z        d       t        j                  t
        t        z  t        j                        }| j                  d|       | j                  d|       t        sJ| j                  t        j                  j                  j                         j                         d   |       y y )	N_UnionGenericAliasr  z#_UnionGenericAlias in module typingzUnion = typing.Unionr   	UnionTypez UnionType in module types objectz!
class UnionType(builtins.object))r   r5   r.  r3  Unionr;  r   r   r5  r   r!   r7   r   r   typesr:  r(  s     r$   test_union_typez TestDescriptions.test_union_type  s2   S#X(>?AUVv||CH5P;SA,c2<<MM&,,..446AACAFLc	2K@sSy5??C8#>:C@#MM%//11779DDFqI3O $r#   c                    | j                  t        j                  t        j                        d       t        j
                  t        j                  t        j                        }| j                  d|       t        j                  j                  r\| j                  d|       | j                  t        j                  j                  j                         j                         d   |       y | j                  d|       y )N_SpecialFormr  z_SpecialForm in module typingzNoReturn = typing.NoReturnr   z%NoReturn = class _SpecialForm(_Final))r   r5   r.  r3  NoReturnr   r5  r   r!   r7   r   r(  s     r$   test_special_formz"TestDescriptions.test_special_form  s    8.IvI5s;??""MM6<MM&//11779DDFqI3OMMA3Gr#   c           	      <   dt         j                  t         j                     dt        dt         j                  t         j
                  t        t         j                  f      fd}t        j                  d      } G d dt         j                  |   t         j                  t        t        f         }| j                  t        j                  |      j                         d   d	       | j                  t        j                  |      j                         d
   d       y )Ndataxr9  c                      y rs   r"   )rC  rD  s     r$   fooz/TestDescriptions.test_typing_pydoc.<locals>.foo  s    r#   Tc                       e Zd Zy)-TestDescriptions.test_typing_pydoc.<locals>.CNr   r"   r#   r$   r-  rI     s    r#   r-  z?ffoooo(data: List[Any], x: int) -> Iterator[Tuple[int, Any]]r  z2class CC(collections.abc.Mapping, typing.Generic))r3  r4  Anyr;  IteratorTupleTypeVarGenericMappingr   r   r5   r   r   )ro   rF  rG  r-  s       r$   test_typing_pydocz"TestDescriptions.test_typing_pydoc  s    	fkk&**- 		!??6<<VZZ+HI	 NN3Aq!6>>#s(#;A))#.99;B?9	: 	))!,779!<P	Rr#   c                    dD ]<  }| j                  t        j                  |             	 t        j                  |       > dD ]K  }| j                  t        j                  |             | j                  t        t        j                  |       M y # t        $ r# | j                  dj                  |             Y w xY w)N)r   zstr.translatezbuiltins.strzbuiltins.str.translatezfinding the doc of {!r} failed)notbuiltinsstrrrzstrr.translatezstr.trrrranslatezbuiltins.strrrzbuiltins.str.trrranslate)	assertIsNotNoner5   locater   ImportErrorfailr_  r  assertRaises)ro   names     r$   test_builtinzTestDescriptions.test_builtin'  s    /D   d!34I  &/1D ell401k5+;+;TB	1  I		:AA$GHIs   B)B?>B?c                     t        j                  t        j                  |             }|j                  d      }t	        |      dk\  sJ |d   S Nr2   r  )r5   plainr   r  r  or[   liness      r$   _get_summary_linez"TestDescriptions._get_summary_line8  sB    {{5++A./

4 5zQQxr#   c                     t        j                  t        j                  |             }|j                  d      }dj	                  |dd        S r]  )r5   r^  r   r  r  r_  s      r$   _get_summary_linesz#TestDescriptions._get_summary_lines?  s>    {{5++A./

4 yyqr##r#   c                 v    | j                  | j                  t        j                  j                        d       y )Nzwrap(self, text))r   rb  r
  TextWrapperwraprn   s    r$   test_unbound_python_methodz+TestDescriptions.test_unbound_python_methodF  s,    //0D0D0I0IJ	 r#   c                 v    | j                  | j                  t        j                  j                        d       y )Nz1dump(self, obj, /) unbound _pickle.Pickler method)r   rb  _picklePicklerdumprn   s    r$   test_unbound_builtin_methodz,TestDescriptions.test_unbound_builtin_methodJ  s+    //0D0DE?	Ar#   c                     t        j                         }| j                  | j                  |j                        d       y )Nz2wrap(text) method of textwrap.TextWrapper instance)r
  rf  r   rb  rg  )ro   ts     r$   test_bound_python_methodz)TestDescriptions.test_bound_python_methodP  s3      "//7@	Br#   c                    t        dg d      }t        j                  |      }| j                  |j	                  d      |j	                  d             | j                  |j	                  d      |j	                  d              G d d      } G d d	      }t        j                  |       t        j                  |       y )
NrH  )rI  rJ  agegrouprI  rJ  rr  c                       e Zd ZdZy)MTestDescriptions.test_field_order_for_named_tuples.<locals>.NonIterableFieldsNr   r   r    _fieldsr"   r#   r$   NonIterableFieldsrt  Z  s    Gr#   rw  c                       e Zd Zg gZy)MTestDescriptions.test_field_order_for_named_tuples.<locals>.NonHashableFieldsNru  r"   r#   r$   NonHashableFieldsry  ]  s	    dGr#   rz  )r   r5   r   
assertLessindex)ro   rH  r+   rw  rz  s        r$   !test_field_order_for_named_tuplesz2TestDescriptions.test_field_order_for_named_tuplesT  s    H&KLV$
+QWW[-AB,aggj.AB	 		 	 	*+*+r#   c                     t               }t        j                  |      }| j                  | j	                  |j
                        d       y )Nz/dump(obj, /) method of _pickle.Pickler instance)r   rj  rk  r   rb  rl  )ro   r+   ps      r$   test_bound_builtin_methodz*TestDescriptions.test_bound_builtin_methodd  s9    JOOA//7=	?r#   c                 b    | j                  | j                  t        j                        d       y )Nz0stat(path, *, dir_fd=None, follow_symlinks=True))r   rb  rQ   r  rn   s    r$   test_module_level_callablez+TestDescriptions.test_module_level_callablel  s%    //8>	@r#   c                 b    | j                  | j                  t        j                        d       y )Nz*lower(self, /) unbound builtins.str method)r   rb  r   lowerrn   s    r$   "test_unbound_builtin_method_noargsz3TestDescriptions.test_unbound_builtin_method_noargsq  s$    //		:8	:r#   c                 Z    | j                  | j                  dj                        d       y )Nr'   z'lower() method of builtins.str instance)r   rb  r  rn   s    r$    test_bound_builtin_method_noargsz1TestDescriptions.test_bound_builtin_method_noargsu  s$    //95	7r#   c                 :    G d d      }| j                  | j                  |j                  d         d       | j                  | j                  |j                        d       | j	                  dt        j                  t        j                  |                   y )Nc                       e Zd Zed        Zy)-TestDescriptions.test_staticmethod.<locals>.Xc                      y)zA static methodNr"   rD  ys     r$   smz0TestDescriptions.test_staticmethod.<locals>.X.sm|       r#   N)r   r   r    staticmethodr  r"   r#   r$   Xr  {  s     r#   r  r  zsm(x, y)
    A static method
zJ
 |  Static methods defined here:
 |
 |  sm(x, y)
 |      A static method
)r   rd  __dict__r  r   r5   r^  r   ro   r  s     r$   test_staticmethodz"TestDescriptions.test_staticmethody  s    	 	
 	00D1AB1	2 	006 9 	 	 
 [[!!!$%	'r#   c                 :    G d d      }| j                  | j                  |j                  d         d       | j                  | j                  |j                        d       | j	                  dt        j                  t        j                  |                   y )Nc                       e Zd Zed        Zy),TestDescriptions.test_classmethod.<locals>.Xc                      y)zA class methodNr"   )clsrD  s     r$   cmz/TestDescriptions.test_classmethod.<locals>.X.cm  r  r#   N)r   r   r    classmethodr  r"   r#   r$   r  r    s     r#   r  r  zcm(...)
    A class method
zFcm(x) class method of test.test_pydoc.test_pydoc.X
    A class method
zE
 |  Class methods defined here:
 |
 |  cm(x)
 |      A class method
)r   rd  r  r  r   r5   r^  r   r  s     r$   test_classmethodz!TestDescriptions.test_classmethod  s    	 	
 	00D1AB0	1 	006 9 	 	 
 [[!!!$%	'r#   c                 |   | j                  | j                  t        j                        d       | j                  | j                  t        j
                        d       | j                  | j                  t        j                        d       | j                  | j                  t        j                        d       y )N	numeratorrealr:   obj)
r   rb  r;  r  floatr  r   r:   
memoryviewr  rn   s    r$   test_getset_descriptorz'TestDescriptions.test_getset_descriptor  s     	//>L//

;VD//	?H//
?Gr#   c                    | j                  | j                  t        j                        d       | j                  | j                  t        j
                        d       | j                  | j                  t        j
                        d       | j                  | j                  t        j                        d       | j                  | j                  t        j                        d       y )Nr  startfgetvalue)r   rb  complexr  ranger  slicepropertyr  StopIterationr  rn   s    r$   test_member_descriptorz'TestDescriptions.test_member_descriptor  s     	//=vF//<gF//<gF//>G//0C0CDgNr#   c                 n     G d d      }| j                  | j                  |j                        d       y )Nc                       e Zd ZdZy)4TestDescriptions.test_slot_descriptor.<locals>.Pointr  N)r   r   r    	__slots__r"   r#   r$   Pointr    s     Ir#   r  rD  )r   rb  rD  )ro   r  s     r$   test_slot_descriptorz%TestDescriptions.test_slot_descriptor  s+    	! 	!//8#>r#   c                 t     G d d      }| j                  | j                  |j                  d         d       y )Nc                       e Zd Zy)6TestDescriptions.test_dict_attr_descriptor.<locals>.NSNr   r"   r#   r$   NSr    r   r#   r  r  )r   rb  r  )ro   r  s     r$   test_dict_attr_descriptorz*TestDescriptions.test_dict_attr_descriptor  s3    	 	//J0GH#	%r#   c                    | j                  | j                  t        t        j                        j
                        d       | j                  | j                  t        t        j                        j                        d       | j                  | j                  t        t        j                        j                        d       | j                  | j                  t        t        j                        j                        d       y )Nwidthdebugmajormax)r   rb  r   rl   	hash_infor  flagsr  version_infor  
float_infor  rn   s    r$    test_structseq_member_descriptorz1TestDescriptions.test_structseq_member_descriptor  s    //S]]0C0I0IJ 	"//SYY0E0EF 	"//S5E5E0F0L0LM 	"//S^^0D0H0HI	 r#   c                 r    t        dd      }| j                  | j                  |j                        d       y )NBox)r  heightz    Alias for field number 0
)r   r   rd  r  )ro   r  s     r$    test_namedtuple_field_descriptorz1TestDescriptions.test_namedtuple_field_descriptor  s3     3400; > 	r#   c                      G d d      }| j                  | j                  |j                        d       | j                  dt	        j
                  t	        j                  |                   y )Nc                       e Zd Zed        Zy),TestDescriptions.test_property.<locals>.Rectc                 4    | j                   | j                  z  S )zArea of the rect)rX  hrn   s    r$   areaz1TestDescriptions.test_property.<locals>.Rect.area  s     vv&r#   N)r   r   r    r  r  r"   r#   r$   Rectr    s    ' 'r#   r  z    Area of the rect
z#
 |  area
 |      Area of the rect
)r   rd  r  r   r5   r^  r   )ro   r  s     r$   test_propertyzTestDescriptions.test_property  s^    	' 	' 	00; > 	 	  [[!!$'(	*r#   c                     G d d       G fdd      }| j                  | j                  |j                        dt         d       d|j                  _        | j                  | j                  |j                        dt         d       d	|j                  _        | j                  | j                  |j                        d
       y )Nc                       e Zd Zd Zy)?TestDescriptions.test_custom_non_data_descriptor.<locals>.Descrc                     || S yNr   r"   ro   r  r  s      r$   __get__zGTestDescriptions.test_custom_non_data_descriptor.<locals>.Descr.__get__      ;Kr#   N)r   r   r    r  r"   r#   r$   Descrr    s    r#   r  c                       e Zd Z W         Zy);TestDescriptions.test_custom_non_data_descriptor.<locals>.XNr   r   r    attrr  s   r$   r  r    
    7Dr#   r  rc   zH.TestDescriptions.test_custom_non_data_descriptor.<locals>.Descr object>Custom descriptorz_.TestDescriptions.test_custom_non_data_descriptor.<locals>.Descr object>
    Custom descriptor
rF  zfoo(...)
    Custom descriptor
)r   rd  r  r   r!   ro   r  r  s     @r$   test_custom_non_data_descriptorz0TestDescriptions.test_custom_non_data_descriptor  s    	 	
	 	 	008 ?
S;W 	X -008 ?
 ; 	
  008 ; 	r#   c                 x    G d d       G fdd      }| j                  | j                  |j                        d       d|j                  _        | j                  | j                  |j                        d       d|j                  _        | j                  | j                  |j                        d	       y )
Nc                       e Zd Zd Zd Zy);TestDescriptions.test_custom_data_descriptor.<locals>.Descrc                     || S yr  r"   r  s      r$   r  zCTestDescriptions.test_custom_data_descriptor.<locals>.Descr.__get__  r  r#   c                     ddz   y )Nr   r   r"   r  s      r$   __set__zCTestDescriptions.test_custom_data_descriptor.<locals>.Descr.__set__  s	    !r#   N)r   r   r    r  r  r"   r#   r$   r  r     s    r#   r  c                       e Zd Z W         Zy)7TestDescriptions.test_custom_data_descriptor.<locals>.XNr  r  s   r$   r  r    r  r#   r  r'   r  z    Custom descriptor
rF  zfoo
    Custom descriptor
)r   rd  r  r!   r   r  s     @r$   test_custom_data_descriptorz,TestDescriptions.test_custom_data_descriptor  s    	 		 	 	008"=,008 ; 	  008 ; 	r#   c                 
   dt         fd}t        j                  t        j                  j	                  |            }| j                  d|       t        j                         j	                  |      }| j                  d|       y )Nr9  c                    K   ywr   r"   )igns    r$   coro_functionz=TestDescriptions.test_async_annotation.<locals>.coro_function  s	     s   zasync coro_functionz4async <a name="-coro_function"><strong>coro_function)r;  r5   r^  r5  documentr   rC   )ro   r  r[   rd   s       r$   test_async_annotationz&TestDescriptions.test_async_annotation  sd    	 	 {{5??33MBC+T2}}''6B	r#   c                     d }t        j                  t         j                  j                  |            }| j	                  d|       t        j
                         j                  |      }| j	                  d|       y )Nc                    K   d y wr   r"   r"   r#   r$   an_async_generatorzLTestDescriptions.test_async_generator_annotation.<locals>.an_async_generator$  s     Gs   	zasync an_async_generatorz>async <a name="-an_async_generator"><strong>an_async_generator)r5   r^  r5  r  r   rC   )ro   r  r[   rd   s       r$   test_async_generator_annotationz0TestDescriptions.test_async_generator_annotation#  s_    	 {{5??334FGH0$7}}''(:;L	r#   c                 t    d }t        j                         j                  |      }| j                  d|       y )Nc                       y)za link https://localhost/Nr"   r"   r#   r$   a_fn_with_https_linkzHTestDescriptions.test_html_for_https_links.<locals>.a_fn_with_https_link1  s    r#   z3<a href="https://localhost/">https://localhost/</a>)r5   rC   r  r   )ro   r  rd   s      r$   test_html_for_https_linksz*TestDescriptions.test_html_for_https_links/  s2    	 }}''(<=A	
r#   c                 :    ddl m} t        j                  |       y )Nr   )module_none)test.test_pydocr  r5   r   )ro   r  s     r$   test_module_nonez!TestDescriptions.test_module_none;  s    /%r#   N)&r   r   r    rp   r)  r/  r7  r=  rA  rQ  r[  r  rb  rd  rh  r   rm  rp  r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r"   r#   r$   r%  r%    s   3*
5EPH
RC"   $ $  A A
B,  ? ? @ @:7 ' '( ' '( H H O O ? ?
 % %       * *  0  0

 	
 	
&r#   r%  c                   l    e Zd Zd Zd Zej                  fdZej                  fdZd Z	d Z
d Zd Zy	)
PydocFodderTestc                 R    | j                  t        j                  d   t               y ri   rj   rn   s    r$   rp   zPydocFodderTest.tearDownB  r   r#   c                     |j                         }d\  }}||j                  |      }||j                  ||      }||| S )N)r   N)r   r|  )ro   r[   	beginlineendlinera  
beginindexendindexs          r$   
getsectionzPydocFodderTest.getsectionE  sO    !&
H Y/J{{7J7HZ))r#   c                    t        j                         }|j                  |      }t        |      }|t        j
                  u rdnd}| j                  |d| dd      }| j                  d|       | j                  d|       | j                  d|       | j                  d	|       | j                  d
|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  |d| dd      }| j                  d|       |t        j
                  u rdnd}| j                  d|z   |       | j                  d|       | j                  d|       | j                  d|       | j                  |d| dd      }| j                  d|       | j                  d|       y )Ndefined hereinherited from Bz |  Methods :zJ |  ----------------------------------------------------------------------z# |  A_method_alias = A_method(self)z# |  B_method_alias = B_method(self)z; |  A_staticmethod(x, y) from test.test_pydoc.pydocfodder.Az/ |  A_staticmethod_alias = A_staticmethod(x, y)z6 |  global_func(x, y) from test.test_pydoc.pydocfodderz) |  global_func_alias = global_func(x, y)zL |  global_func2_alias = global_func2(x, y) from test.test_pydoc.pydocfodderz* |  __repr__(self, /) from builtins.objectz# |  object_repr = __repr__(self, /)z |  Static methods zV |  A_classmethod_ref = A_classmethod(x) class method of test.test_pydoc.pydocfodder.Ar'   . class method of test.test_pydoc.pydocfodder.Bz( |  B_classmethod_ref = B_classmethod(x)zN |  A_method_ref = A_method() method of test.test_pydoc.pydocfodder.A instancez> |  get(key, default=None, /) method of builtins.dict instancezI |  dict_get = get(key, default=None, /) method of builtins.dict instancez |  Class methods z |  B_classmethod(x)z* |  B_classmethod_alias = B_classmethod(x))r5   rU   r   rN   r   r   r  r   ro   r  rG   r   wherera  notes          r$   test_text_doc_routines_in_classz/PydocFodderTest.test_text_doc_routines_in_classN  s   mmoc"F#"%"6<N,ugQ(?Q;UC;UCSUZ[GONPUVA5IdfklBEJ;UC*=eWA(FXnpuvKMM)r/_@4GOfhmnVX]^achi*<UG1(EW,e4BEJr#   c                 D   t        j                         }|j                  |      }t        |      }|t        j
                  u rdnd}| j                  |d| dd      }| j                  d|       | j                  d|       | j                  d|       | j                  d	|       | j                  d
|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  |d| dd      }| j                  d|       |t        j
                  u rdnd}| j                  d|z   |       | j                  d|       | j                  |d| dd      }| j                  d|       | j                  d|       y )Nr  r  zMethods r  ra   zA_method_alias = A_method(self)zB_method_alias = B_method(self)z7A_staticmethod(x, y) from test.test_pydoc.pydocfodder.Az+A_staticmethod_alias = A_staticmethod(x, y)z2global_func(x, y) from test.test_pydoc.pydocfodderz%global_func_alias = global_func(x, y)zHglobal_func2_alias = global_func2(x, y) from test.test_pydoc.pydocfodderz&__repr__(self, /) from builtins.objectzobject_repr = __repr__(self, /)zStatic methods zRA_classmethod_ref = A_classmethod(x) class method of test.test_pydoc.pydocfodder.Ar'   r	  z$B_classmethod_ref = B_classmethod(x)zJA_method_ref = A_method() method of test.test_pydoc.pydocfodder.A instancezClass methods zB_classmethod(x)z&B_classmethod_alias = B_classmethod(x))r5   rC   r   re   r   r   r  r   r
  s          r$   test_html_doc_routines_in_classz/PydocFodderTest.test_html_doc_routines_in_classj  sw   mmoc"6""%"6<N(5'(;VD7?7?OQVWCUKJER=uE`bgh>F7?/%(BFKjlqrKMM)r/_<tCUKbdij.q(A6J(%0>Fr#   c                 B    | j                  t        j                         y rs   )r  r   Drn   s    r$   )test_text_doc_inherited_routines_in_classz9PydocFodderTest.test_text_doc_inherited_routines_in_class      ,,[]];r#   c                 B    | j                  t        j                         y rs   )r  r   r  rn   s    r$   )test_html_doc_inherited_routines_in_classz9PydocFodderTest.test_html_doc_inherited_routines_in_class  r  r#   c                    t        j                         }|j                  t              }t	        |      }| j                  |dd      }| j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d	|       | j                  d
|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       y )N	FUNCTIONSFILEz)    global_func_alias = global_func(x, y)z    A_staticmethod(x, y)z/    A_staticmethod_alias = A_staticmethod(x, y)z&    A_classmethod(x) class method of Az7    A_classmethod2 = A_classmethod(x) class method of Az7    A_classmethod3 = A_classmethod(x) class method of Bz#    A_method() method of A instancez/    A_method2 = A_method() method of A instancez/    A_method3 = A_method() method of B instancez-    A_staticmethod_ref = A_staticmethod(x, y)z@    A_staticmethod_ref2 = A_staticmethod(y) method of B instancez>    get(key, default=None, /) method of builtins.dict instancezI    dict_get = get(key, default=None, /) method of builtins.dict instancez    B_method(self)z    B_method2 = B_method(self))r5   rU   rD   r   rN   r  r   ro   rG   r   ra  s       r$    test_text_doc_routines_in_modulez0PydocFodderTest.test_text_doc_routines_in_module  s   mmo{+F#V<A5I0%8GO>FOQVWOQVW;UCGOGOEuMXZ_`VX]^achi*E26>r#   c                    t        j                         }|j                  t              }t	        |      }| j                  |dd       }| j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d	|       | j                  d
|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       y )Nz
 Functionsz& global_func_alias = global_func(x, y)z A_staticmethod(x, y)z, A_staticmethod_alias = A_staticmethod(x, y)z"A_classmethod(x) class method of Az4 A_classmethod2 = A_classmethod(x) class method of Az4 A_classmethod3 = A_classmethod(x) class method of Bz  A_method() method of A instancez, A_method2 = A_method() method of A instancez, A_method3 = A_method() method of B instancez* A_staticmethod_ref = A_staticmethod(x, y)z= A_staticmethod_ref2 = A_staticmethod(y) method of B instancez; get(key, default=None, /) method of builtins.dict instancezF dict_get = get(key, default=None, /) method of builtins.dict instancez B_method(self)z B_method2 = B_method(self))r5   rC   rD   r   re   r  r   r  s       r$    test_html_doc_routines_in_modulez0PydocFodderTest.test_html_doc_routines_in_module  s   mmo{+6"d;>F-u5DeL:EBLeTLeT8%@DeLDeLBEJUW\]SUZ[^`ef'/3U;r#   N)r   r   r    rp   r  r   r   r  r  r  r  r  r  r"   r#   r$   r  r  A  s>    3* 3>-- K8 3>-- G4<<?2<r#   r  z/Socket server not available on Emscripten/WASI.c                       e Zd ZdZd Zd Zy)PydocServerTestzTests for pydoc._start_serverc                 R    | j                  t        j                  d   t               y ri   rj   rn   s    r$   rp   zPydocServerTest.tearDown  r   r#   c           	      :   d }t        j                  |dd      | j                  j                  d        | j	                  j
                         | j                  fd       | j                  dj                         | j                  t               | j                  dt        t        j                  j                  j                  d            j                                | j                  dt        t        j                  j                  j                  d	            j                                j                          | j!                  j
                         | j#                  j$                         | j#                  j                         y )
Nc                     d| d|d}|S )Nzthe URL sent was: (z, )r"   )r   content_typer[   s      r$   my_url_handlerz3PydocServerTest.test_server.<locals>.my_url_handler  s    36EDKr#   	localhostr   )hostnameportc                  @     j                   r j                         S d S rs   )servingstop)serverthreads   r$   r7  z-PydocServerTest.test_server.<locals>.<lambda>  s    <+?+?L%%'ITIr#   s$   the URL sent was: (/test, text/html)z/tests'   the URL sent was: (/test.css, text/css)z	/test.css)r5   _start_serverr   errorr  r)  r\  r   r   r   r   r   r   urljoinreadr*  r  r  	docserver)ro   r$  r+  s     @r$   test_serverzPydocServerTest.test_server  s<   	 ** 
 	++T2,,-I	 	k<#3#34
#3FLL(()9)97CDIIK	 	6FLL(()9)9;GHMMO	
 	--.,001,**+r#   N)r   r   r    r!   rp   r1  r"   r#   r$   r  r    s    
 (3 ,r#   r  c                       e Zd ZdZd Zd Zy)PydocUrlHandlerTestzTests for pydoc._url_handlerc                     t         j                  }| j                  t        |dd       | j                  t        |dd       y )Nr   r'   r   foobar)r5   r~   rY  	TypeError)ro   r  s     r$   test_content_type_errz)PydocUrlHandlerTest.test_content_type_err  s5    )QR0)QX6r#   c                 F   g d}| j                  t        j                  d   t               	 | j	                         5  |D ]  \  }}| j                  ||        	 d d d        t        t        j                  d<   y # 1 sw Y   !xY w# t        t        j                  d<   w xY w)N))r'   Pydoc: Index of Modules)zget?key=r9  )r|  r9  )r  zPydoc: Topics)r  zPydoc: Keywords)r5   Pydoc: module pydoc)zget?key=pydocr:  )zsearch?key=pydocr  )ztopic?key=defzPydoc: KEYWORD def)ztopic?key=STRINGSzPydoc: TOPIC STRINGS)r5  zPydoc: Error - foobarr5   )rk   rl   rm   r5   r|   r   )ro   requestsr   r^   s       r$   test_url_requestsz%PydocUrlHandlerTest.test_url_requests  s     	ckk'*E2	),,."*JC))#u5 #+ /
 $)CKK  /.
 $)CKK s"   B A;B ;B B B N)r   r   r    r!   r7  r<  r"   r#   r$   r3  r3    s    &7
)r#   r3  c                       e Zd Zd Zy)
TestHelperc                     | j                  t        t        j                  j                        t        t
        j                               y rs   )r   sortedr5   r   r  keywordkwlistrn   s    r$   test_keywordszTestHelper.test_keywords  s-     5 56/	1r#   N)r   r   r    rC  r"   r#   r$   r>  r>    s    1r#   r>  c                      e Zd Zd Z ej
                   eed      xr  ej                         d      e	d               Z
 ej
                   eed      xr  ej                         d      e	d               Z ej
                   eed      xr  ej                         d      e	d               Z ej
                   eed      xr  ej                         d      e	d               Zd Zy	)
PydocWithMetaClassesc                 R    | j                  t        j                  d   t               y ri   rj   rn   s    r$   rp   zPydocWithMetaClasses.tearDown  r   r#   r   r   c                 >    G d dt               } G d d|      }t        d t        D              }t               }t	        j
                  |      } ||       t        t        f|d d z   z  }|j                         j                         }| j                  ||       y )	Nc                        e Zd Z fdZ xZS )=PydocWithMetaClasses.test_DynamicClassAttribute.<locals>.Metac                 .    |dk(  ryt         |   |      S )Nhamspamsuper__getattr__ro   rZ  r  s     r$   rO  zIPydocWithMetaClasses.test_DynamicClassAttribute.<locals>.Meta.__getattr__  s    5=!w*400r#   )r   r   r    rO  __classcell__r  s   @r$   MetarI    s    1 1r#   rS  c                   0    e Zd Zej                  d        Zy);PydocWithMetaClasses.test_DynamicClassAttribute.<locals>.DAc                      y)Neggsr"   rn   s    r$   rK  z?PydocWithMetaClasses.test_DynamicClassAttribute.<locals>.DA.ham!  s    r#   N)r   r   r    r<  DynamicClassAttributerK  r"   r#   r$   DArU     s    (( )r#   rY  	metaclassc              3   .   K   | ]  }|rd |z   nd  yw)z	
 |      r'   Nr"   r)   s     r$   r,   zBPydocWithMetaClasses.test_DynamicClassAttribute.<locals>.<genexpr>$  s'      .I/G! CDlQ.>.K/Gr-   r   r  )r   r  expected_data_docstringsr   r5   r   !expected_dynamicattribute_patternr   r   r7   r   )ro   rS  rY  r   rH   r  r   r   s           r$   test_DynamicClassAttributez/PydocWithMetaClasses.test_DynamicClassAttribute  s    	14 	1
	4 	 ). .I/G.I )I%V,r
9;BQ??A"((*/r#   c                     G d dt               } G d d|      }t               }t        j                  |      } ||       t        t
        z  }|j                         j                         }| j                  ||       y )Nc                   $     e Zd Zd Z fdZ xZS )HPydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.<locals>.Metac                 
    g dS )N)r  r   r   LIFEr"   r  s    r$   __dir__zPPydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.<locals>.Meta.__dir__3  s    FFr#   c                 .    |dk(  ryt         |   |      S )Nrd  r   )rN  _Meta__getattrrP  s     r$   rO  zTPydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.<locals>.Meta.__getattr__5  s    &=w(..r#   r   r   r    rf  rO  rQ  rR  s   @r$   rS  rb  2  s    G/ /r#   rS  c                       e Zd Zy)IPydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.<locals>.ClassNr   r"   r#   r$   Classrk  9  r   r#   rl  rZ  r   )	r   r   r5   r   "expected_virtualattribute_pattern1r   r   r7   r   )ro   rS  rl  rH   r  r   r   s          r$   %test_virtualClassAttributeWithOneMetaz:PydocWithMetaClasses.test_virtualClassAttributeWithOneMeta.  se    	/4 	/	d 	V,u:XE"((*/r#   c                 (  
  G d dt               
 G d dt                G 
fdd
      } G d d
	      } G d
 d||	      }t               }t        j                  |      } ||       t        t
        z  }|j                         j                         }| j                  ||       t               }t        j                  |      } ||       t        t
        z  }|j                         j                         }	| j                  ||	       y )Nc                   $     e Zd Zd Z fdZ xZS )IPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta1c                 
    g dS )N)r  r   r   r   r"   re  s    r$   rf  zQPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta1.__dir__G      EEr#   c                 .    |dk(  ryt         |   |      S )Nr   r   rM  rP  s     r$   rO  zUPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta1.__getattr__I      %<w*400r#   ri  rR  s   @r$   Meta1rq  F      F1 1r#   rv  c                   $     e Zd Zd Z fdZ xZS )IPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta2c                 
    g dS )N)r  r   r   twor"   re  s    r$   rf  zQPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta2.__dir__N  rs  r#   c                 .    |dk(  ryt         |   |      S )Nr{  r  rM  rP  s     r$   rO  zUPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta2.__getattr__P  ru  r#   ri  rR  s   @r$   Meta2ry  M  rw  r#   r}  c                   ,     e Zd ZfdZ fdZ xZS )IPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta3c           
          t        t        t        g dj                  |       z   j                  |       z                     S )N)r  r   r   three)r6  r@  setrf  )r  rv  r}  s    r$   rf  zQPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta3.__dir__U  sC    F3DMM#&').s);<$= > ? ?r#   c                 .    |dk(  ryt         |   |      S )Nr  r  rM  rP  s     r$   rO  zUPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Meta3.__getattr__Y  s    '>w*400r#   ri  )r  rv  r}  s   @r$   Meta3r  T  s    ?1 1r#   r  c                       e Zd Zy)JPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Class1Nr   r"   r#   r$   Class1r  ]  r   r#   r  rZ  c                       e Zd Zy)JPydocWithMetaClasses.test_virtualClassAttributeWithTwoMeta.<locals>.Class2Nr   r"   r#   r$   Class2r  _  r   r#   r  r   )
r   r   r5   r   "expected_virtualattribute_pattern2r   r   r7   r   "expected_virtualattribute_pattern3)ro   r  r  r  rH   r  expected_text1result1expected_text2result2rv  r}  s             @@r$   %test_virtualClassAttributeWithTwoMetaz:PydocWithMetaClasses.test_virtualClassAttributeWithTwoMetaB  s    	1D 	1	1D 	1	1E5 	1	u 		Vu 	V,v;hF//#))+1V,v;hF//#))+1r#   c                     G d dt               } G d d|      }t               }t        j                  |      } ||       t        t
        z  }|j                         j                         }| j                  ||       y )Nc                       e Zd Zd Zy).PydocWithMetaClasses.test_buggy_dir.<locals>.Mc                 
    g dS )N)r  r   missingherer"   re  s    r$   rf  z6PydocWithMetaClasses.test_buggy_dir.<locals>.M.__dir__s  s    CCr#   N)r   r   r    rf  r"   r#   r$   Mr  r  s    Dr#   r  c                       e Zd ZdZy).PydocWithMetaClasses.test_buggy_dir.<locals>.Czpresent!N)r   r   r    r  r"   r#   r$   r-  r  u  s    Dr#   r-  rZ  r   )	r   r   r5   r   !expected_missingattribute_patternr   r   r7   r   )ro   r  r-  rH   r  r   r   s          r$   test_buggy_dirz#PydocWithMetaClasses.test_buggy_dirn  sg    	D 	D	! 	V,q	9HD"((*/r#   c                     t               5 }t        j                  d       d d d        j                         }| j	                  d|       y # 1 sw Y   ,xY w)Nz	enum.Enumz
class Enum)r   r5   r   r   r   )ro   r?  r(  s      r$   test_resolve_falsez'PydocWithMetaClasses.test_resolve_false~  sB     'JJ{# ##%lH- s   AAN)r   r   r    rp   r  r  r  rl   r   r   r_  rn  r  r  r  r"   r#   r$   rE  rE    s   3 X__WS*-@,#,,.HJ0 J0( X__WS*-@,#,,.HJ0 J0" X__WS*-@,#,,.HJ'2 J'2R X__WS*-@,#,,.HJ0 J0.r#   rE  c                   8    e Zd Zd Zd	dZd Zd Zd Zd Zd Z	y)
TestInternalUtilitiesc                 H   t        j                         }|j                  | _        t        j
                  j                  |j                  d      | _        | j                  |j                         t	        j                         x| _        }dt        j                  |g| _        y )Nnonexistentr'   )rp  TemporaryDirectoryrZ  argv0dirrQ   rR   r  argv0r\  cleanupgetcwd
abs_curdircurdircurdir_spellings)ro   tmpdirr  s      r$   r  zTestInternalUtilities.setUp  sj    ,,.WW\\&++}=
'')yy{2*!#RYY
 ;r#   Nc                 J    || j                   }t        j                  ||      S rs   )r  r5   _get_revised_path)ro   
given_pathr  s      r$   r  z'TestInternalUtilities._get_revised_path  s%     =JJE&&z599r#   c                     t         j                  j                         }| j                  D ]2  }t	        |j                  |            D ]  }|j                  |        4 |S rs   )rl   rR   copyr  r  countr  )ro   
clean_pathspelling__s       r$   _get_starting_pathz(TestInternalUtilities._get_starting_path  sQ    XX]]_
--HJ,,X67!!(+ 8 . r#   c                     | j                         }| j                  g|z   }| j                  | j                  |      |       y rs   )r  r  r   r  )ro   r  expected_paths      r$   ,test_sys_path_adjustment_adds_missing_curdirzBTestInternalUtilities.test_sys_path_adjustment_adds_missing_curdir  s<    ,,.
)J6//
;]Kr#   c                    | j                         }| j                  g|z   }| j                  g|z   }| j                  | j	                  |      |       || j                  gz   }| j                  | j	                  |      |       y rs   )r  r  r  r   r  )ro   r  r  leading_argv0dirtrailing_argv0dirs        r$   *test_sys_path_adjustment_removes_argv0_dirz@TestInternalUtilities.test_sys_path_adjustment_removes_argv0_dir  s{    ,,.
)J6 MM?Z7//0@A=Q&$--8//0ABMRr#   c                      fd} j                         } j                  g|z   } j                  g|z   } j                   ||      |       | j                  gz   } j                  g|z   } j                   ||      |       y )Nc                 F    j                  | t        j                        S )N)r  )r  r5   r6   )r  ro   s    r$   r  z\TestInternalUtilities.test_sys_path_adjustment_protects_pydoc_dir.<locals>._get_revised_path  s    ))*ENN)KKr#   )r  r  r  r   )ro   r  r  r  r  r  s   `     r$   +test_sys_path_adjustment_protects_pydoc_dirzATestInternalUtilities.test_sys_path_adjustment_protects_pydoc_dir  s    	L,,.
 MM?Z7),<<*+;<mL&$--8),==*+<=}Mr#   c                    | j                         }| j                  D ]  }| j                  |      5  |g|z   }| j                  | j	                  |             ||gz   }| j                  | j	                  |             | j
                  g|z   }| j                  | j	                  |             || j
                  gz   }| j                  | j	                  |             d d d         y # 1 sw Y   xY w)N)curdir_spelling)r  r  subTestr  r  r  )ro   r  r  leading_curdirtrailing_curdirr  r  s          r$   5test_sys_path_adjustment_when_curdir_already_includedzKTestInternalUtilities.test_sys_path_adjustment_when_curdir_already_included  s    ,,.
--Hh7"*j!8!!$"8"8"HI",z"9!!$"8"8"IJ$(MM?^#C !!$"8"89I"JK$3t}}o$E!!!$"8"89J"KL 87 .77s   B-C**C3	rs   )
r   r   r    r  r  r  r  r  r  r  r"   r#   r$   r  r    s)    <:L
S	NMr#   r  c                      t        j                         } t        j                  t         j                  g|   t        j                  t
               y rs   )r   threading_setupr  addModuleCleanupthreading_cleanupr   )thread_infos    r$   setUpModuler    s8    "224K.@@O;Om,r#   __main__)arQ   rl   r   importlib.utilr  r   rf  r5   r  rA  rj  r{   rL   r  rp  test.supporttestr<  r3  r  unittest.mockurllib.parser   	xml.etreer   xml.etree.ElementTreer
  r   collectionsr   urllib.requestr   r   r   r   r	   test.support.script_helperr
   r   r   r   r   r   r   r   r   r   r   r   test.support.os_helperr   r   r   r  r   r   r   HAVE_DOCSTRINGSr]  r7   r   r  r   r   expected_html_data_docstringsr1   r  r   r  r^  rm  r  r  r  r?   rA   rJ   rN   rV   rX   r_   re   TestCaserg   r   r  r%  r  r  r  r3  r>  rE  r  r  r   mainr"   r#   r$   <module>r     s   	 
    	      	             " .  & "M M )E E E < ; % '	 	 << 
  0\x 
EGy | !& &I/G&I !I M ^ !& &I/G&I !I , -4GD"**,E  N %  
EG! "$& 
EG #& 
EG #&, 
EG- #0% 
EG ""		 H%%  F`
38$$ `
3F[)m [)|]&x(( ]&@y<h'' y<x W5%,h'' %,	%,P!)- !)H1"" 1q.8,, q.h=MH-- =M@- zHMMO r#   