%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib64/python3.9/site-packages/numpy/testing/_private/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib64/python3.9/site-packages/numpy/testing/_private/__pycache__/noseclasses.cpython-39.pyc

a

z[yc�8�@sddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
mZddlm
Z
ddlmZddlmZddlmZmZGd	d
�d
ej�ZGdd�dej�ZGd
d�dej�Ze��ZGdd�dej�ZGdd�d�ZGdd�de�Z e Z!Gdd�de
�Z"Gdd�dej#j$�Z%dS)�N)�doctests)�
ErrorClass�ErrorClassPlugin)�Plugin)�src�)�get_package_name)�KnownFailureException�KnownFailureTestc@seZdZdd�Zdd�ZdS)�NumpyDocTestFindercCs�|durdSt�|�r"|j|juSt�|�r8|j|jkSt�|�rN|j|jkSt�|�rh|j|j	j
jkSt�|�dur�|t�|�uSt|d�r�|j|jkSt
|t�r�dStd��dS)zY
        Return true if the given object is defined in the given
        module.
        NT�
__module__z"object must be a class or function)�inspect�
isfunction�__dict__�__globals__Z	isbuiltin�__name__r�isclass�ismethod�__self__�	__class__Z	getmodule�hasattr�
isinstance�property�
ValueError)�self�module�object�r�H/usr/lib64/python3.9/site-packages/numpy/testing/_private/noseclasses.py�_from_modules"





zNumpyDocTestFinder._from_modulec
CsDtj�||||||||�ddlm}m}	m}
m}m}|
|�r�|j	r�|j
��D]H\}
}|�d|
��}||�st|	|�rN|�||�rN|�|||||||�qN|	|��r@|j	�r@|j
��D]�\}
}t
|t�r�t||
�}t
|t�r�t||
�j}||��s|	|��s||��st
|t�r�|�||�r�|�d|
��}
|�|||
||||�q�dS)zm
        Find tests for the given object and any contained objects, and
        add them to `tests`.
        r)�	isroutiner�ismodulerr�.N)�doctest�
DocTestFinder�_findr
r rr!rrZ_recurser�itemsrr�staticmethod�getattr�classmethod�__func__r)r�tests�obj�namerZsource_lines�globs�seenr rr!rrZvalname�valZvalname1rrrr%:s<�
��


��
��zNumpyDocTestFinder._findN)rr�__qualname__rr%rrrrrsrc@seZdZdd�ZdS)�NumpyOutputCheckercCsztj�||||�}|svd|vr"dS|�dd�}|�dd�}dD]$}|�d|d�}|�d|d�}q>tj�||||�}|S)Nz#randomTz'>z'<)��z'<i%d'�int)r#�
OutputChecker�check_output�replace)rZwantZgot�optionflags�retZszrrrr7ls�
�zNumpyOutputChecker.check_outputN)rrr1r7rrrrr2ksr2c@seZdZddd�ZdS)�NumpyDocTestCaserN�_cCs(||_||_tjj||||||d�dS)N)r9�setUp�tearDown�checker)Z_result_varZ	_nose_objr#�DocTestCase�__init__)r�testr9r=r>r?r,�
result_varrrrrA�s
�zNumpyDocTestCase.__init__)rNNNNr<)rrr1rArrrrr;�s�r;c@sjeZdZdZdZejejBZddgZ	e
ZeZ
eZejfdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�ZdS)�NumpyDoctestZnumpydoctesti�zgenerate_numpy_api.pyzsetup.pycCst�|||�d|_d|_dS)NT)r�optionsZ
doctest_tests�doctest_result_var�r�parser�envrrrrE�szNumpyDoctest.optionscCsBt�|||�|��|_t��|_|jr>dd�|jjD�|j_dS)NcSsg|]}|jdkr|�qS)r#)r-��.0�prrr�
<listcomp>�s
�z*NumpyDoctest.configure.<locals>.<listcomp>)	r�	configure�test_finder_class�finderr#Z
DocTestParserrH�enabled�plugins�rrE�configrrrrN�s


zNumpyDoctest.configurecCsXttj�|j��}tddtd�|_d|vrT|�d�}|d}t	||ji|g�|j|<dS)a` Configure `test` object to set test context

        We set the numpy / scipy standard doctest namespace

        Parameters
        ----------
        test : test object
            with ``globs`` dictionary defining namespace

        Returns
        -------
        None

        Notes
        -----
        `test` object modified in place
        �__main__)�__builtins__�__file__rZnpZscipyr"���N)
r�os�path�dirname�filenamerV�numpyr.�split�
__import__)rrB�pkg_namerLZp2rrr�set_test_context�s
�
zNumpyDoctest.set_test_contextccs�|�|j�stj�d|�dSz|j�|�}WntyBYdS0|sLdS|��t	|j
�}|D]>}|jsnqb|jsz||_|�
|�|j||j|��|jd�VqbdS)NzDoctest doesn't want module %s)r9r?rC)�matchesr�npd�log�debugrP�find�AttributeError�sortrrWZexamplesr\ra�doctest_case_class�doctest_optflags�out_check_classrF)rrr+Zmodule_filerBrrr�loadTestsFromModule�s,

�z NumpyDoctest.loadTestsFromModulecCstjfit��dS�N)r]Zset_printoptions�print_state�rrrr�afterContextszNumpyDoctest.afterContextcCs(tj�|�}||jvrdStj�||�S)NF)rYrZ�basename�doctest_ignorerc�Doctest�wantFile)r�fileZbnrrrrts
zNumpyDoctest.wantFileN)rrr1r-�scorer#ZNORMALIZE_WHITESPACE�ELLIPSISrjrrr;rir2rkrrOrY�environrErNrarlrprtrrrrrD�s�	
*rDc@s6eZdZdZdZdZdZd
dd�Zdd	�Zd
d�Z	dS)�	Unpluggerzi Nose plugin to remove named plugin late in loading

    By default it removes the "doctest" plugin.
    Z	unpluggerTi�r#cCs
||_dSrm)�	to_unplug)rrzrrrrAszUnplugger.__init__cCsdSrmrrGrrrrEszUnplugger.optionscs�fdd�|jjD�|j_dS)Ncsg|]}|j�jkr|�qSr)r-rzrJrorrrMs�z'Unplugger.configure.<locals>.<listcomp>)rRrSrrorrNszUnplugger.configureN)r#)
rrr1�__doc__r-rQrvrArErNrrrrry
s
ryc@s8eZdZdZdZeeddd�Zej	fdd�Z
dd	�Zd
S)�KnownFailurePlugina1Plugin that installs a KNOWNFAIL error class for the
    KnownFailureClass exception.  When KnownFailure is raised,
    the exception will be logged in the knownfail attribute of the
    result, 'K' or 'KNOWNFAIL' (verbose) will be output, and the
    exception will not be counted as an error or failure.TZ	KNOWNFAILF)ZlabelZ	isfailurecCs$d}|jddd|�|d�dd�dS)NZNOSE_WITHOUT_KNOWNFAILz--no-knownfail�
store_true�noKnownFailFz3Disable special handling of KnownFailure exceptions)�action�dest�default�help)Z
add_option�get)rrHrIZenv_optrrrrE-s
�zKnownFailurePlugin.optionscCs*|js
dS||_t|dd�}|r&d|_dS)Nr~F)Z
can_configure�confr(rQ)rrEr��disablerrrrN4szKnownFailurePlugin.configureN)rrr1r{rQrr	Z	knownfailrYrxrErNrrrrr|"s�r|c@seZdZdZdd�ZdS)�FPUModeCheckPluginzx
    Plugin that checks the FPU mode before and after each test,
    raising failures if the test changed the mode.
    csddlm���fdd�}|S)Nr)�get_fpu_modecsZ��}��|���}||krVztd�||���Wn"tyT|��t���Yn0dS)Nz6FPU mode changed from {0:#x} to {1:#x} during the test)rB�AssertionError�formatZ
addFailure�sys�exc_info)�resultZold_modeZnew_mode�r�rBrr�runHs
��z/FPUModeCheckPlugin.prepareTestCase.<locals>.run)Znumpy.core._multiarray_testsr�)rrBr�rr�r�prepareTestCaseEs
z"FPUModeCheckPlugin.prepareTestCaseN)rrr1r{r�rrrrr�?sr�c@seZdZdd�ZdS)�NumpyTestProgramcCsh|jdur(tjj|jj|jj|jd�|_|jj�|j�}|durF||_|j�	|j
�|_|j��|_
|j
S)aRun Tests. Returns true on success, false on failure, and
        sets self.success to the same value.

        Because nose currently discards the test result object, but we need
        to return it to the user, override TestProgram.runTests to retain
        the result
        N)�stream�	verbosityrT)Z
testRunner�nose�coreZTextTestRunnerrTr�r�rRZprepareTestRunnerr�rBr�Z
wasSuccessful�success)rZplug_runnerrrr�runTests[s
�zNumpyTestProgram.runTestsN)rrr1r�rrrrr�Zsr�)&rYr�r#r
r]r�Znose.pluginsrrcZnose.plugins.errorclassrrZnose.plugins.baserZ	nose.utilrZ
nosetesterrZutilsr	r
r$rr6r2r@r;Zget_printoptionsrnrsrDryr|ZKnownFailurer�r�ZTestProgramr�rrrr�<module>s*	Ox

Zerion Mini Shell 1.0