3
O้dข  ใ               @   sจ   d Z ddlZddlZddlmZmZ ddlmZ ejj	dkZ
dZdZdZd	Zeeed
ZdZdd Zdd Zdd Zejje
dddd Zejje
dddd ZdS )z@ Some tests for the documenting decorator and support functions ้    N)ฺassert_equalฺsuppress_warnings)ฺdoccer้   zBDocstring
    %(strtest1)s
        %(strtest2)s
     %(strtest3)s
z Another test
   with some indentzAnother test, one linez(    Another test
       with some indent)ฺstrtest1ฺstrtest2ฺstrtest3z|Docstring
    Another test
       with some indent
        Another test, one line
     Another test
       with some indent
c           
   C   sR   t  B} | jtd ttjtt ttjtt ttjtt W d Q R X d S )N)ฺcategory)	r   ฺfilterฺDeprecationWarningr   r   Zunindent_stringฺ
param_doc1ฺ
param_doc2ฺ
param_doc3)ฺsupฉ r   ๚P/var/www/html/virt/lib64/python3.6/site-packages/scipy/misc/tests/test_doccer.pyฺtest_unindent+   s
    r   c              C   sb   t  } | jtd tjt}W d Q R X t|d td  t|d td  t|d td  d S )N)r	   r   r   r   )r   r
   r   r   ฺunindent_dictฺdoc_dictr   )r   Zd2r   r   r   ฺtest_unindent_dict3   s    r   c           
   C   s\   t  L} | jtd tjt}tjt|}t|t	 d}tj|t}t|d W d Q R X d S )N)r	   zSingle line doc %(strtest1)sz0Single line doc Another test
   with some indent)
r   r
   r   r   r   r   Z	docformatฺ	docstringr   ฺfilled_docstring)r   Zuddฺ	formattedZ
single_docr   r   r   ฺtest_docformat<   s    

r   zdocstrings stripped)ฺreasonc           
   C   sj   t  Z} | jtd tjtd}|dd }t|jd tjtd}|dd }t|jd W d Q R X d S )	N)r	   Tc               S   s   dS )z0 Docstring
            %(strtest3)s
            Nr   r   r   r   r   ฺfuncQ   s    ztest_decorator.<locals>.funczP Docstring
            Another test
               with some indent
            Fc               S   s   dS )z0 Docstring
            %(strtest3)s
            Nr   r   r   r   r   r   ^   s    zX Docstring
                Another test
                   with some indent
            )r   r
   r   r   Zfilldocr   r   ฺ__doc__)r   ฺ	decoratorr   r   r   r   ฺtest_decoratorJ   s    r   c                 s   t  6} | jtd G dd dt G  fddd }W d Q R X t|jj jjd  t|jj jj | }t|jj jjd  t|jj jj d S )N)r	   c               @   s   e Zd Zdd Zdd ZdS )z(test_inherit_docstring_from.<locals>.Fooc             S   s   dS )zDo something useful.Nr   )ฺselfr   r   r   r   p   s    z-test_inherit_docstring_from.<locals>.Foo.funcc             S   s   dS )zSomething else.Nr   )r   r   r   r   ฺfunc2t   s    z.test_inherit_docstring_from.<locals>.Foo.func2N)ฺ__name__ฺ
__module__ฺ__qualname__r   r    r   r   r   r   ฺFooo   s   r$   c                   s0   e Zd Zej dd Zej dd ZdS )z(test_inherit_docstring_from.<locals>.Barc             S   s   dS )z%(super)sABCNr   )r   r   r   r   r   x   s    z-test_inherit_docstring_from.<locals>.Bar.funcc             S   s   d S )Nr   )r   r   r   r   r    }   s    z.test_inherit_docstring_from.<locals>.Bar.func2N)r!   r"   r#   r   Zinherit_docstring_fromr   r    r   )r$   r   r   ฺBarw   s   r%   ฺABC)r   r
   r   ฺobjectr   r   r   r    )r   r%   ฺbarr   )r$   r   ฺtest_inherit_docstring_fromi   s    r)   )r   ฺsysZpytestZnumpy.testingr   r   Z
scipy.miscr   ฺflagsฺoptimizeZDOCSTRINGS_STRIPPEDr   r   r   r   r   r   r   r   r   ฺmarkZskipifr   r)   r   r   r   r   ฺ<module>   s$   		