a
    _@                     @   sF   d Z ddlZG dd dejZG dd dejZG dd dejZdS )	zDocumentation tests.
    Nc                   @   sl   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd ZdS )Test_asStructuredTextc                 C   s   ddl m} ||S )Nr   )asStructuredText)zope.interface.documentr   )selfifacer    r   D/usr/lib/python3/dist-packages/zope/interface/tests/test_document.py_callFUT   s    zTest_asStructuredText._callFUTc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   	Interface

)INoDocstring Attributes:	 Methods: c                   @   s   e Zd ZdS )zNTest_asStructuredText.test_asStructuredText_no_docstring.<locals>.INoDocstringN__name__
__module____qualname__r   r   r   r   r   !   s   r   zope.interfacer   joinassertEqualr	   r   r   EXPECTEDr   r   r   r   "test_asStructuredText_no_docstring   s    z8Test_asStructuredText.test_asStructuredText_no_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )IEmpty This is an empty interface.r   r   r   c                   @   s   e Zd ZdZdS )zPTest_asStructuredText.test_asStructuredText_empty_with_docstring.<locals>.IEmpty) This is an empty interface.
            Nr   r   r   __doc__r   r   r   r   r   .   s   r   r   r   r   r   r   r   r   r   *test_asStructuredText_empty_with_docstring%   s    z@Test_asStructuredText.test_asStructuredText_empty_with_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   
)r   r   r    P             It can be used to annotate any class or object, because it promises             nothing.r   r   r   r   r   r   c                   @   s   e Zd ZdZdS )zZTest_asStructuredText.test_asStructuredText_empty_with_multiline_docstring.<locals>.IEmpty This is an empty interface.

            It can be used to annotate any class or object, because it promises
            nothing.
            Nr   r   r   r   r   r   D   s   r   r   r!   r   r   r   4test_asStructuredText_empty_with_multiline_docstring3   s    zJTest_asStructuredText.test_asStructuredText_empty_with_multiline_docstringc                    sP   ddl m  ddl m} dg d}G  fddd|}| | || d S )Nr   	Attributer
   r   )IHasAttribute! This interface has an attribute.r   z"  an_attribute -- no documentationr   r   c                       s   e Zd ZdZ dZdS )z^Test_asStructuredText.test_asStructuredText_with_attribute_no_docstring.<locals>.IHasAttribute. This interface has an attribute.
            an_attributeNr   r   r   r    r.   r   r)   r   r   r+   W   s   r+   r   r*   r   r   r   r	   r   r   r   r+   r   r)   r   1test_asStructuredText_with_attribute_no_docstringL   s
    zGTest_asStructuredText.test_asStructuredText_with_attribute_no_docstringc                    sP   ddl m  ddl m} dg d}G  fddd|}| | || d S )Nr   r)   r
   r   )r+   r,   r   z/  an_attribute -- This attribute is documented.r   r   c                       s   e Zd ZdZ ddZdS )z`Test_asStructuredText.test_asStructuredText_with_attribute_with_docstring.<locals>.IHasAttributer-   r.   This attribute is documented.Nr/   r   r)   r   r   r+   i   s   r+   r0   r1   r   r)   r   3test_asStructuredText_with_attribute_with_docstring^   s
    zITest_asStructuredText.test_asStructuredText_with_attribute_with_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )
IHasMethod This interface has a method.r   r   z  aMethod() -- no documentationr   c                   @   s   e Zd ZdZdd ZdS )z`Test_asStructuredText.test_asStructuredText_with_method_no_args_no_docstring.<locals>.IHasMethod* This interface has a method.
            c                   S   s   d S Nr   r   r   r   r   aMethod~   s    zhTest_asStructuredText.test_asStructuredText_with_method_no_args_no_docstring.<locals>.IHasMethod.aMethodNr   r   r   r    r9   r   r   r   r   r5   {   s   r5   r   r   r   r   r5   r   r   r   6test_asStructuredText_with_method_no_args_no_docstringq   s    zLTest_asStructuredText.test_asStructuredText_with_method_no_args_no_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )r5   r6   r   r   z,  aMethod(first, second) -- no documentationr   c                   @   s   e Zd ZdZdd ZdS )zhTest_asStructuredText.test_asStructuredText_with_method_positional_args_no_docstring.<locals>.IHasMethodr7   c                 S   s   d S r8   r   firstsecondr   r   r   r9      s    zpTest_asStructuredText.test_asStructuredText_with_method_positional_args_no_docstring.<locals>.IHasMethod.aMethodNr:   r   r   r   r   r5      s   r5   r   r;   r   r   r   >test_asStructuredText_with_method_positional_args_no_docstring   s    zTTest_asStructuredText.test_asStructuredText_with_method_positional_args_no_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )r5   r6   r   r   z3  aMethod(first, second, *rest) -- no documentationr   c                   @   s   e Zd ZdZdd ZdS )zaTest_asStructuredText.test_asStructuredText_with_method_starargs_no_docstring.<locals>.IHasMethodr7   c                 W   s   d S r8   r   r>   r?   restr   r   r   r9      s    ziTest_asStructuredText.test_asStructuredText_with_method_starargs_no_docstring.<locals>.IHasMethod.aMethodNr:   r   r   r   r   r5      s   r5   r   r;   r   r   r   7test_asStructuredText_with_method_starargs_no_docstring   s    zMTest_asStructuredText.test_asStructuredText_with_method_starargs_no_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )r5   r6   r   r   z2  aMethod(first, second, **kw) -- no documentationr   c                   @   s   e Zd ZdZdd ZdS )z_Test_asStructuredText.test_asStructuredText_with_method_kwargs_no_docstring.<locals>.IHasMethodr7   c                 [   s   d S r8   r   r>   r?   kwr   r   r   r9      s    zgTest_asStructuredText.test_asStructuredText_with_method_kwargs_no_docstring.<locals>.IHasMethod.aMethodNr:   r   r   r   r   r5      s   r5   r   r;   r   r   r   5test_asStructuredText_with_method_kwargs_no_docstring   s    zKTest_asStructuredText.test_asStructuredText_with_method_kwargs_no_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )r5   r6   r   r   z)  aMethod() -- This method is documented.r   c                   @   s   e Zd ZdZdd ZdS )zZTest_asStructuredText.test_asStructuredText_with_method_with_docstring.<locals>.IHasMethodr7   c                   S   s   dS z+This method is documented.
                Nr   r   r   r   r   r9      s    zbTest_asStructuredText.test_asStructuredText_with_method_with_docstring.<locals>.IHasMethod.aMethodNr:   r   r   r   r   r5      s   r5   r   r;   r   r   r   0test_asStructuredText_with_method_with_docstring   s    zFTest_asStructuredText.test_asStructuredText_with_method_with_docstringc                    s`   ddl m  ddl m} dg d}G dd d|}G  fdd	d	|}| | || d S )
Nr   r)   r
   r   )IDerived IDerived doc This interface extends:z	  o IBaser   z  attr1 -- no documentationz  attr2 -- attr2 docr   z  method3() -- method3 docz  method4() -- no documentationz  method5() -- method5 docr   c                   @   s   e Zd Zdd Zdd ZdS )zOTest_asStructuredText.test_asStructuredText_derived_ignores_base.<locals>.IBasec                   S   s   d S r8   r   r   r   r   r   method1   s    zWTest_asStructuredText.test_asStructuredText_derived_ignores_base.<locals>.IBase.method1c                   S   s   d S r8   r   r   r   r   r   method2   s    zWTest_asStructuredText.test_asStructuredText_derived_ignores_base.<locals>.IBase.method2Nr   r   r   rL   rM   r   r   r   r   IBase   s   rO   c                       s:   e Zd ZdZ dZ ddZdd Zdd Zd	d
 ZdS )zRTest_asStructuredText.test_asStructuredText_derived_ignores_base.<locals>.IDerivedIDerived docattr1attr2	attr2 docc                   S   s   dS zmethod3 docNr   r   r   r   r   method3   s    zZTest_asStructuredText.test_asStructuredText_derived_ignores_base.<locals>.IDerived.method3c                   S   s   d S r8   r   r   r   r   r   method4   s    zZTest_asStructuredText.test_asStructuredText_derived_ignores_base.<locals>.IDerived.method4c                   S   s   dS zmethod5 docNr   r   r   r   r   method5   s    zZTest_asStructuredText.test_asStructuredText_derived_ignores_base.<locals>.IDerived.method5N	r   r   r   r    rQ   rR   rU   rV   rX   r   r)   r   r   rI      s   
rI   r0   r   r   r   rO   rI   r   r)   r   *test_asStructuredText_derived_ignores_base   s    z@Test_asStructuredText.test_asStructuredText_derived_ignores_baseN)r   r   r   r	   r   r"   r(   r2   r4   r<   r@   rC   rF   rH   r[   r   r   r   r   r      s   r   c                   @   sl   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd ZdS )Test_asReStructuredTextc                 C   s   ddl m} ||S )Nr   )asReStructuredText)r   r]   )r   r   r]   r   r   r   r	      s    z Test_asReStructuredText._callFUTc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )z``INoDocstring``r   r   r   c                   @   s   e Zd ZdS )zRTest_asReStructuredText.test_asReStructuredText_no_docstring.<locals>.INoDocstringNr   r   r   r   r   r     s   r   r   r   r   r   r   $test_asReStructuredText_no_docstring   s    z<Test_asReStructuredText.test_asReStructuredText_no_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )
``IEmpty``r   r   r   r   c                   @   s   e Zd ZdZdS )zTTest_asReStructuredText.test_asReStructuredText_empty_with_docstring.<locals>.IEmptyr   Nr   r   r   r   r   r     s   r   r   r!   r   r   r   ,test_asReStructuredText_empty_with_docstring  s    zDTest_asReStructuredText.test_asReStructuredText_empty_with_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r#   )r_   r   r   r$   r%   r&   r   r   r   r   r   r   c                   @   s   e Zd ZdZdS )z^Test_asReStructuredText.test_asReStructuredText_empty_with_multiline_docstring.<locals>.IEmptyr'   Nr   r   r   r   r   r   $  s   r   r   r!   r   r   r   6test_asReStructuredText_empty_with_multiline_docstring  s    zNTest_asReStructuredText.test_asReStructuredText_empty_with_multiline_docstringc                    sP   ddl m  ddl m} dg d}G  fddd|}| | || d S )Nr   r)   r
   r   )``IHasAttribute``r,   r   z&  ``an_attribute`` -- no documentationr   r   c                       s   e Zd ZdZ dZdS )zbTest_asReStructuredText.test_asReStructuredText_with_attribute_no_docstring.<locals>.IHasAttributer-   r.   Nr/   r   r)   r   r   r+   7  s   r+   r0   r1   r   r)   r   3test_asReStructuredText_with_attribute_no_docstring,  s
    zKTest_asReStructuredText.test_asReStructuredText_with_attribute_no_docstringc                    sP   ddl m  ddl m} dg d}G  fddd|}| | || d S )Nr   r)   r
   r   )rb   r,   r   z3  ``an_attribute`` -- This attribute is documented.r   r   c                       s   e Zd ZdZ ddZdS )zdTest_asReStructuredText.test_asReStructuredText_with_attribute_with_docstring.<locals>.IHasAttributer-   r.   r3   Nr/   r   r)   r   r   r+   I  s   r+   r0   r1   r   r)   r   5test_asReStructuredText_with_attribute_with_docstring>  s
    zMTest_asReStructuredText.test_asReStructuredText_with_attribute_with_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )``IHasMethod``r6   r   r   z#  ``aMethod()`` -- no documentationr   c                   @   s   e Zd ZdZdd ZdS )zdTest_asReStructuredText.test_asReStructuredText_with_method_no_args_no_docstring.<locals>.IHasMethodr7   c                   S   s   d S r8   r   r   r   r   r   r9   ^  s    zlTest_asReStructuredText.test_asReStructuredText_with_method_no_args_no_docstring.<locals>.IHasMethod.aMethodNr:   r   r   r   r   r5   [  s   r5   r   r;   r   r   r   8test_asReStructuredText_with_method_no_args_no_docstringQ  s    zPTest_asReStructuredText.test_asReStructuredText_with_method_no_args_no_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )re   r6   r   r   z0  ``aMethod(first, second)`` -- no documentationr   c                   @   s   e Zd ZdZdd ZdS )zlTest_asReStructuredText.test_asReStructuredText_with_method_positional_args_no_docstring.<locals>.IHasMethodr7   c                 S   s   d S r8   r   r=   r   r   r   r9   p  s    ztTest_asReStructuredText.test_asReStructuredText_with_method_positional_args_no_docstring.<locals>.IHasMethod.aMethodNr:   r   r   r   r   r5   m  s   r5   r   r;   r   r   r   @test_asReStructuredText_with_method_positional_args_no_docstringc  s    zXTest_asReStructuredText.test_asReStructuredText_with_method_positional_args_no_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )re   r6   r   r   z7  ``aMethod(first, second, *rest)`` -- no documentationr   c                   @   s   e Zd ZdZdd ZdS )zeTest_asReStructuredText.test_asReStructuredText_with_method_starargs_no_docstring.<locals>.IHasMethodr7   c                 W   s   d S r8   r   rA   r   r   r   r9     s    zmTest_asReStructuredText.test_asReStructuredText_with_method_starargs_no_docstring.<locals>.IHasMethod.aMethodNr:   r   r   r   r   r5     s   r5   r   r;   r   r   r   9test_asReStructuredText_with_method_starargs_no_docstringu  s    zQTest_asReStructuredText.test_asReStructuredText_with_method_starargs_no_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )re   r6   r   r   z6  ``aMethod(first, second, **kw)`` -- no documentationr   c                   @   s   e Zd ZdZdd ZdS )zcTest_asReStructuredText.test_asReStructuredText_with_method_kwargs_no_docstring.<locals>.IHasMethodr7   c                 [   s   d S r8   r   rD   r   r   r   r9     s    zkTest_asReStructuredText.test_asReStructuredText_with_method_kwargs_no_docstring.<locals>.IHasMethod.aMethodNr:   r   r   r   r   r5     s   r5   r   r;   r   r   r   7test_asReStructuredText_with_method_kwargs_no_docstring  s    zOTest_asReStructuredText.test_asReStructuredText_with_method_kwargs_no_docstringc                 C   s@   ddl m} dg d}G dd d|}| | || d S )Nr   r
   r   )re   r6   r   r   z-  ``aMethod()`` -- This method is documented.r   c                   @   s   e Zd ZdZdd ZdS )z^Test_asReStructuredText.test_asReStructuredText_with_method_with_docstring.<locals>.IHasMethodr7   c                   S   s   dS rG   r   r   r   r   r   r9     s    zfTest_asReStructuredText.test_asReStructuredText_with_method_with_docstring.<locals>.IHasMethod.aMethodNr:   r   r   r   r   r5     s   r5   r   r;   r   r   r   2test_asReStructuredText_with_method_with_docstring  s    zJTest_asReStructuredText.test_asReStructuredText_with_method_with_docstringc                    s`   ddl m  ddl m} dg d}G dd d|}G  fdd	d	|}| | || d S )
Nr   r)   r
   r   )z``IDerived``rJ   rK   z  o ``IBase``r   z  ``attr1`` -- no documentationz  ``attr2`` -- attr2 docr   z  ``method3()`` -- method3 docz#  ``method4()`` -- no documentationz  ``method5()`` -- method5 docr   c                   @   s   e Zd Zdd Zdd ZdS )zSTest_asReStructuredText.test_asReStructuredText_derived_ignores_base.<locals>.IBasec                   S   s   d S r8   r   r   r   r   r   rL     s    z[Test_asReStructuredText.test_asReStructuredText_derived_ignores_base.<locals>.IBase.method1c                   S   s   d S r8   r   r   r   r   r   rM     s    z[Test_asReStructuredText.test_asReStructuredText_derived_ignores_base.<locals>.IBase.method2NrN   r   r   r   r   rO     s   rO   c                       s:   e Zd ZdZ dZ ddZdd Zdd Zd	d
 ZdS )zVTest_asReStructuredText.test_asReStructuredText_derived_ignores_base.<locals>.IDerivedrP   rQ   rR   rS   c                   S   s   dS rT   r   r   r   r   r   rU     s    z^Test_asReStructuredText.test_asReStructuredText_derived_ignores_base.<locals>.IDerived.method3c                   S   s   d S r8   r   r   r   r   r   rV     s    z^Test_asReStructuredText.test_asReStructuredText_derived_ignores_base.<locals>.IDerived.method4c                   S   s   dS rW   r   r   r   r   r   rX     s    z^Test_asReStructuredText.test_asReStructuredText_derived_ignores_base.<locals>.IDerived.method5NrY   r   r)   r   r   rI     s   
rI   r0   rZ   r   r)   r   ,test_asReStructuredText_derived_ignores_base  s    zDTest_asReStructuredText.test_asReStructuredText_derived_ignores_baseN)r   r   r   r	   r^   r`   ra   rc   rd   rf   rg   rh   ri   rj   rk   r   r   r   r   r\      s   r\   c                   @   s<   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )Test__justify_and_indentc                 K   s   ddl m} |||fi |S )Nr   )_justify_and_indent)r   rm   )r   textlevelrE   rm   r   r   r   r	     s    z!Test__justify_and_indent._callFUTc                 C   s*   ddg}d |}| | |d| d S )NThree blind miceSee how they runr#   r   r   r   r	   r   ZLINESrn   r   r   r   test_simple_level_0  s    
z,Test__justify_and_indent.test_simple_level_0c                 C   s:   ddg}d |}| | |dd dd |D  d S )Nrp   rq   r#      c                 S   s   g | ]}d | qS r$   r   .0liner   r   r   
<listcomp>      z@Test__justify_and_indent.test_simple_level_1.<locals>.<listcomp>rr   rs   r   r   r   test_simple_level_1  s
    
z,Test__justify_and_indent.test_simple_level_1c                 C   s:   ddg}d |}| | |dd dd |D  d S )Nrp   rq   r#   ru   c                 S   s   g | ]}d | qS rv   r   rw   r   r   r   rz     r{   z@Test__justify_and_indent.test_simple_level_2.<locals>.<listcomp>rr   rs   r   r   r   test_simple_level_2  s
    
z,Test__justify_and_indent.test_simple_level_2c                 C   s:   ddg}d |}| | |dd dd |D  d S )Nrp   rq   z
ru   r#   c                 S   s   g | ]}d | qS rv   r   rw   r   r   r   rz     r{   z?Test__justify_and_indent.test_simple_w_CRLF.<locals>.<listcomp>rr   rs   r   r   r   test_simple_w_CRLF  s
    
z+Test__justify_and_indent.test_simple_w_CRLFc                 C   s&   d}d}|  | j|dddd| d S )NzTThis is a piece of text longer than 15 characters, 
and split across multiple lines.z_  This is a piece
  of text longer
  than 15 characters,
  and split across
  multiple lines.
 ru      )Zmungewidth)r   r	   )r   ZTEXTr   r   r   r   test_with_munge  s    z(Test__justify_and_indent.test_with_mungeN)	r   r   r   r	   rt   r|   r}   r~   r   r   r   r   r   rl     s   rl   )r    ZunittestZTestCaser   r\   rl   r   r   r   r   <module>   s    a a