HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/numpy/testing/_private/__pycache__/noseclasses.cpython-310.pyc
o

6��a�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�|durdSt�|�r|j|juSt�|�r|j|jkSt�|�r'|j|jkSt�|�r4|j|j	j
jkSt�|�durB|t�|�uSt|d�rM|j|jkSt
|t�rTdStd��)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__�	isbuiltin�__name__r�isclass�ismethod�__self__�	__class__�	getmodule�hasattr�
isinstance�property�
ValueError)�self�module�object�r�D/usr/lib/python3/dist-packages/numpy/testing/_private/noseclasses.py�_from_modules"





zNumpyDocTestFinder._from_modulec
CsBtj�||||||||�ddlm}m}	m}
m}m}|
|�rL|j	rL|j
��D]$\}
}|�d|
��}||�s:|	|�rK|�||�rK|�|||||||�q'|	|�r�|j	r�|j
��D]F\}
}t
|t�rft||
�}t
|t�rqt||
�j}||�s�|	|�s�||�s�t
|t�r�|�||�r�|�d|
��}
|�|||
||||�qXdSdSdS)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#rr�_recurser�itemsr!r�staticmethod�getattr�classmethod�__func__r)r�tests�obj�namer�source_lines�globs�seenr"rr#rr�valname�val�valname1rrr r':sD�
���


��
����zNumpyDocTestFinder._findN)rr�__qualname__r!r'rrrr rsrc@�eZdZdd�ZdS)�NumpyOutputCheckercCsztj�||||�}|s;d|vrdS|�dd�}|�dd�}dD]}|�d|d�}|�d|d�}qtj�||||�}|S)Nz#randomTz'>z'<)��z'<i%d'�int)r%�
OutputChecker�check_output�replace)r�want�got�optionflags�ret�szrrr r>ls�
�zNumpyOutputChecker.check_outputN)rrr7r>rrrr r9k�r9c@seZdZ		ddd�ZdS)�NumpyDocTestCaserN�_cCs(||_||_tjj||||||d�dS)N)rB�setUp�tearDown�checker)�_result_var�	_nose_objr%�DocTestCase�__init__)r�testrBrHrIrJr/�
result_varrrr rN�s

�zNumpyDocTestCase.__init__)rNNNNrG)rrr7rNrrrr rF�s�rFc@sjeZdZdZdZejejBZddgZ	e
ZeZ
eZejfdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�ZdS)�NumpyDoctest�numpydoctesti�zgenerate_numpy_api.pyzsetup.pycCst�|||�d|_d|_dS)NT)r�options�
doctest_tests�doctest_result_var�r�parser�envrrr rS�s
zNumpyDoctest.optionscCsFt�|||�|��|_t��|_|jr!dd�|jjD�|j_dSdS)NcSsg|]	}|jdkr|�qS�r%)r0��.0�prrr �
<listcomp>�s
�z*NumpyDoctest.configure.<locals>.<listcomp>)	r�	configure�test_finder_class�finderr%�
DocTestParserrW�enabled�plugins�rrS�configrrr r^�s

�zNumpyDoctest.configurecCs\ttj�|j��}tddtd�|_d|vr,|�d�}|d}t	||ji|g�|j|<dSdS)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__r�np�scipyr$���N)
r�os�path�dirname�filenamerg�numpyr2�split�
__import__)rrO�pkg_namer\�p2rrr �set_test_context�s
�
�zNumpyDoctest.set_test_contextccs��|�|j�stj�d|�dSz|j�|�}Wn
ty"YdSw|s'dS|��t	|j
�}|D]}|js8q2|js>||_|�
|�|j||j|��|jd�Vq2dS)NzDoctest doesn't want module %s)rBrJrP)�matchesr�npd�log�debugr`�find�AttributeError�sortrrh�examplesroru�doctest_case_class�doctest_optflags�out_check_classrU)rrr.�module_filerOrrr �loadTestsFromModule�s2��


��z NumpyDoctest.loadTestsFromModulecCstjdit��dS)Nr)rp�set_printoptions�print_state�rrrr �afterContextszNumpyDoctest.afterContextcCs(tj�|�}||jvr
dStj�||�S)NF)rlrm�basename�doctest_ignorerw�Doctest�wantFile)r�file�bnrrr r�s
zNumpyDoctest.wantFileN)rrr7r0�scorer%�NORMALIZE_WHITESPACE�ELLIPSISrr�rFr~r9r�rr_rl�environrSr^rur�r�r�rrrr rQ�s �	
*rQc@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.
    �	unpluggerTi�r%cCs
||_dS�N)�	to_unplug)rr�rrr rNs
zUnplugger.__init__cCsdSr�rrVrrr rSszUnplugger.optionscs�fdd�|jjD�|j_dS)Ncsg|]
}|j�jkr|�qSr)r0r�rZr�rr r]s�z'Unplugger.configure.<locals>.<listcomp>)rcrdrr�r r^szUnplugger.configureNrY)
rrr7�__doc__r0rbr�rNrSr^rrrr r�
s
r�c@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.T�	KNOWNFAILF)�label�	isfailurecCs$d}|jddd|�|d�dd�dS)N�NOSE_WITHOUT_KNOWNFAILz--no-knownfail�
store_true�noKnownFailFz3Disable special handling of KnownFailure exceptions)�action�dest�default�help)�
add_option�get)rrWrX�env_optrrr rS-s

�zKnownFailurePlugin.optionscCs.|jsdS||_t|dd�}|rd|_dSdS)Nr�F)�
can_configure�confr+rb)rrSr��disablerrr r^4s
�zKnownFailurePlugin.configureN)rrr7r�rbrr	�	knownfailrlr�rSr^rrrr r�"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_modecsX��}��|���}||kr*ztd�||���ty)|��t���YdSwdS)Nz6FPU mode changed from {0:#x} to {1:#x} during the test)rO�AssertionError�format�
addFailure�sys�exc_info)�result�old_mode�new_mode�r�rOrr �runHs
���z/FPUModeCheckPlugin.prepareTestCase.<locals>.run)�numpy.core._multiarray_testsr�)rrOr�rr�r �prepareTestCaseEs
z"FPUModeCheckPlugin.prepareTestCaseN)rrr7r�r�rrrr r�?sr�c@r8)�NumpyTestProgramcCsh|jdurtjj|jj|jj|jd�|_|jj�|j�}|dur#||_|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�	verbosityre)�
testRunner�nose�core�TextTestRunnerrer�r�rc�prepareTestRunnerr�rOr��
wasSuccessful�success)r�plug_runnerrrr �runTests[s
�zNumpyTestProgram.runTestsN)rrr7r�rrrr r�ZrEr�)&rlr�r%r
rpr��nose.pluginsrrw�nose.plugins.errorclassrr�nose.plugins.baser�	nose.utilr�
nosetesterr�utilsr	r
r&rr=r9rMrF�get_printoptionsr�r�rQr�r��KnownFailurer�r��TestProgramr�rrrr �<module>s,	Ox