U
    f»{j  ã                   @   sÆ   d dl Z d dlmZmZ d dlmZ d dlmZmZm	Z	m
Z
mZ d dlZe j deef¡dd„ ƒZdd	„ Ze
d
ƒdd„ ƒZe
dƒG dd„ deƒƒZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )é    N)Ú	open_docsÚgrade_to_tris)Úadd_channels_epochs)Úcopy_function_doc_to_method_docÚcopy_docÚlinkcode_resolveÚ
deprecatedÚdeprecated_aliasÚobjc                 C   s*   | j }d|kst‚| tkr&d|ks&t‚dS )z#Test that docs are filled properly.z
verbose : zpassed as a keywordN)Ú__doc__ÚAssertionErrorr   )r
   Údoc© r   úX/var/www/html/bwave/python/venv/lib/python3.8/site-packages/mne/utils/tests/test_docs.pyÚtest_doc_filling
   s    r   c                  C   s:   dd„ } t d| ƒ tst‚dtjks(t‚d| jks6t‚dS )zTest deprecated_alias.c                   S   s   dS ©zDo something.Nr   r   r   r   r   Únew_func   s    z'test_deprecated_alias.<locals>.new_funcÚold_funcz(has been deprecated in favor of new_funcr   N)r	   r   r   r   )r   r   r   r   Útest_deprecated_alias   s
    
r   úbad funcc                   C   s   dS r   r   r   r   r   r   Údeprecated_func   s    r   ú	bad classc                   @   s$   e Zd Zdd„ Zedƒdd„ ƒZdS )Údeprecated_classc                 C   s   d S ©Nr   ©Úselfr   r   r   Ú__init__(   s    zdeprecated_class.__init__ú
bad methodc                 C   s   d S r   r   r   r   r   r   Úbad+   s    zdeprecated_class.badN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   %   s   r   c               	   C   sž   dt jkst‚tjdd�� t ƒ  W 5 Q R X dtjjks<t‚tjdd�� tƒ } W 5 Q R X dtjjksjt‚d| jjkszt‚tjdd�� |  ¡  W 5 Q R X dS )zTest deprecated function.Z
DEPRECATEDr   )Úmatchr   r   N)r   r   r   ÚpytestZdeprecated_callr   r   r   )Údepr   r   r   Útest_deprecated0   s    r%   c                     sZ   G dd„ dƒ‰ G dd„ dƒ} G ‡ fdd„dˆ ƒ}|j jdks@t‚t tt| j ƒ|j ¡ dS )	z&Test decorator for copying docstrings.c                   @   s   e Zd Zdd„ ZdS )ztest_copy_doc.<locals>.Ac                   S   s   dS )úDocstring for m1.Nr   r   r   r   r   Úm1A   s    ztest_copy_doc.<locals>.A.m1N©r   r    r!   r'   r   r   r   r   ÚA@   s   r)   c                   @   s   e Zd Zdd„ ZdS )ztest_copy_doc.<locals>.Bc                   S   s   d S r   r   r   r   r   r   r'   F   s    ztest_copy_doc.<locals>.B.m1Nr(   r   r   r   r   ÚBE   s   r*   c                       s   e Zd Ze” jƒdd„ ƒZdS )ztest_copy_doc.<locals>.Cc                   S   s   d S r   r   r   r   r   r   r'   J   s    ztest_copy_doc.<locals>.C.m1N)r   r    r!   r   r'   r   ©r)   r   r   ÚCI   s   r,   r&   N)r'   r   r   r#   ÚraisesÚ
ValueErrorr   )r*   r,   r   r+   r   Útest_copy_doc>   s
    r/   c                     s†   dd„ ‰ dd„ ‰dd„ ‰dd„ } d	d
„ }G ‡ ‡‡fdd„dƒ}|j jdksNt‚|jjdks^t‚|jjdksnt‚t tt|ƒ|j ¡ dS )zDTest decorator for re-using function docstring as method docstrings.c                 S   s   dS )züDocstring for f1.

        Parameters
        ----------
        object : object
            Some object. This description also has

            blank lines in it.
        a : int
            Parameter a
        b : int
            Parameter b
        Nr   )ÚobjectÚaÚbÚcr   r   r   Úf1T   s    z0test_copy_function_doc_to_method_doc.<locals>.f1c                 S   s   dS )zªDocstring for f2.

        Parameters
        ----------
        object : object
            Only one parameter

        Returns
        -------
        nothing.
        Nr   ©r0   r   r   r   Úf2d   s    z0test_copy_function_doc_to_method_doc.<locals>.f2c                 S   s   dS )zxDocstring for f3.

        Parameters
        ----------
        object : object
            Only one parameter
        Nr   r5   r   r   r   Úf3r   s    z0test_copy_function_doc_to_method_doc.<locals>.f3c                 S   s   dS )zDocstring for f4.Nr   r5   r   r   r   Úf4|   s    z0test_copy_function_doc_to_method_doc.<locals>.f4c                 S   s   dS )zrDocstring for f5.

        Parameters
        ----------
        Returns
        -------
        nothing.
        Nr   r5   r   r   r   Úf5€   s    	z0test_copy_function_doc_to_method_doc.<locals>.f5c                       s<   e Zd Ze” ƒdd„ ƒZe”ƒdd„ ƒZe”ƒdd„ ƒZdS )z/test_copy_function_doc_to_method_doc.<locals>.Ac                 S   s   d S r   r   )r   r1   r2   r3   r   r   r   Ú	method_f1Œ   s    z9test_copy_function_doc_to_method_doc.<locals>.A.method_f1c                 S   s   dS )zmethod_f3 own docstringNr   r   r   r   r   Ú	method_f2�   s    z9test_copy_function_doc_to_method_doc.<locals>.A.method_f2c                 S   s   d S r   r   r   r   r   r   Ú	method_f3•   s    z9test_copy_function_doc_to_method_doc.<locals>.A.method_f3N)r   r    r!   r   r:   r;   r<   r   ©r4   r6   r7   r   r   r)   ‹   s   

r)   z‘Docstring for f1.

        Parameters
        ----------
        a : int
            Parameter a
        b : int
            Parameter b
        zcDocstring for f2.

        Returns
        -------
        nothing.
        method_f3 own docstringzDocstring for f3.

        N)	r:   r   r   r;   r<   r#   r-   r.   r   )r8   r9   r)   r   r=   r   Ú$test_copy_function_doc_to_method_docR   s    

r>   c                 C   s   d| kst ‚dS )z
Check url.z	mne.toolsN)r   )Úxr   r   r   Úmyfun®   s    r@   c                  C   sV   t j} zBtt _tƒ  tddƒ tddƒ t ttd¡ t ttdd¡ W 5 | t _X dS )zTest doc launching.Z	tutorialsÚdevZexamplesZstableZfooÚapiN)Ú
webbrowserZopen_new_tabr@   r   r#   r-   r.   )Zold_tabr   r   r   Útest_open_docs³   s    

rD   c                  C   s�   d} t dtddd�ƒ}d|  |ks&t‚t dtddd�ƒ}d|  |ksHt‚t dtdd	d�ƒ}d
|  |ksjt‚t dtddd�ƒ}d|  |ksŒt‚dS )zTest linkcode resolving.z#LÚpyÚmneZEpochs)ÚmoduleÚfullnamez/mne/epochs.pyZcompute_covariancez/mne/cov.pyZconvert_forward_solutionz/mne/forward/forward.pyzdatasets.sample.data_pathz/mne/datasets/sample/sample.pyN)r   Údictr   )ÚexÚurlr   r   r   Útest_linkcode_resolveÂ   s    ÿÿÿrL   )r#   rF   r   r   Z
mne.epochsr   Z	mne.utilsr   r   r   r   r	   rC   ÚmarkZparametrizer   r   r   r0   r   r%   r/   r>   r@   rD   rL   r   r   r   r   Ú<module>   s"   


\