B
    ­'žZ  ã               @   s2   d dl Z d dlZdgZdd„ Zdd„ Zdd„ ZdS )é    NÚmodule_doctestc             C   s„   | dkrdS t  |¡dk	r(| t  |¡kS t  |¡r>| j|jkS t  |¡rT| j|jkS t|dƒrj| j|jkS t	|t
ƒrxdS tdƒ‚dS )zI
    Return true if the given object is defined in the given module.
    NTÚ
__module__z"object must be a class or function)ÚinspectZ	getmoduleZ
isfunctionÚ__dict__Zfunc_globalsZisclassÚ__name__r   ÚhasattrÚ
isinstanceÚpropertyÚ
ValueError)ÚmoduleÚobject© r   ú1lib/python3.7/site-packages/cytoolz/utils_test.pyÚ_from_module   s    



r   c             C   sR   i | _ xFt| ƒD ]:}t| |ƒ}t |¡rt|jtƒrt| |ƒr|j| j |< qW dS )zc
    Extract docstrings from cython functions, that would be skipped by doctest
    otherwise.
    N)	Z__test__ÚdirÚgetattrr   Z	isbuiltinr   Ú__doc__Ústrr   )r   ÚnameÚvaluer   r   r   Ú_fix_module_doctest,   s    

r   c             O   s    t | ƒ tj| f|ž|ŽjdkS )z·
    Fix a Cython module's doctests, then call doctest.testmod()

    All other arguments are passed directly to doctest.testmod().

    Return True on success, False on failure.
    r   )r   ÚdoctestZtestmodZfailed)ÚmÚargsÚkwargsr   r   r   r   9   s    )r   r   Ú__all__r   r   r   r   r   r   r   Ú<module>   s
   