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__/nosetester.cpython-310.pyc
o

6��a�K�@shdZddlZddlZddlZddlZddlmZmZgd�Z	dd�Z
ddd	�ZGd
d�d�Zdd
�Z
dS)ze
Nose test running.

This module implements ``test()`` and ``bench()`` functions for NumPy modules.

�N�)�import_nose�suppress_warnings)�get_package_name�run_module_suite�
NoseTester�
_numpy_testerrrrcCs�|dd�}g}d|vsd|vr*tj�|�\}}|dvrn
|�|�d|vsd|vs|s4d|vr2dSdS|��|d�d�rD|�d�d	�|�S)
a&
    Given a path where a package is installed, determine its name.

    Parameters
    ----------
    filepath : str
        Path to a file. If the determination fails, "numpy" is returned.

    Examples
    --------
    >>> np.testing.nosetester.get_package_name('nonsense')
    'numpy'

    N�
site-packages�
dist-packages)r	r
�scipy�numpyrz.egg�.)�os�path�split�append�reverse�endswith�pop�join)�filepath�fullpath�pkg_name�p2�r�C/usr/lib/python3/dist-packages/numpy/testing/_private/nosetester.pyrs 
�

rcCst|durt�d�}|j�dd�}|durt�|dur!tj|g}n||g}t�}ddlm}|j	||�gd�dS)a�
    Run a test module.

    Equivalent to calling ``$ nosetests <argv> <file_to_run>`` from
    the command line

    Parameters
    ----------
    file_to_run : str, optional
        Path to test module, or None.
        By default, run the module from which this function is called.
    argv : list of strings
        Arguments to be passed to the nose test runner. ``argv[0]`` is
        ignored. All command line arguments accepted by ``nosetests``
        will work. If it is the default value None, sys.argv is used.

        .. versionadded:: 1.9.0

    Examples
    --------
    Adding the following::

        if __name__ == "__main__" :
            run_module_suite(argv=sys.argv)

    at the end of a test module will run the tests when that module is
    called in the python interpreter.

    Alternatively, calling::

    >>> run_module_suite(file_to_run="numpy/tests/test_matlib.py")  # doctest: +SKIP

    from an interpreter will run all the test routine in 'test_matlib.py'.
    Nr�__file__)�KnownFailurePlugin��argv�
addplugins)
�sys�	_getframe�f_locals�get�AssertionErrorrr�noseclassesr�run)�file_to_runr�f�noserrrrr=s#

rc@s^eZdZdZ		ddd�Zdd	�Zd
d�Zdd
�Z		ddd�Z			ddd�Z	ddd�Z
dS)ra�
    Nose test runner.

    This class is made available as numpy.testing.Tester, and a test function
    is typically added to a package's __init__.py like so::

      from numpy.testing import Tester
      test = Tester().test

    Calling this test function finds and runs all tests associated with the
    package and all its sub-packages.

    Attributes
    ----------
    package_path : str
        Full path to the package to test.
    package_name : str
        Name of the package to test.

    Parameters
    ----------
    package : module, str or None, optional
        The package to test. If a string, this should be the full path to
        the package. If None (default), `package` is set to the module from
        which `NoseTester` is initialized.
    raise_warnings : None, str or sequence of warnings, optional
        This specifies which warnings to configure as 'raise' instead
        of being shown once during the test execution.  Valid strings are:

          - "develop" : equals ``(Warning,)``
          - "release" : equals ``()``, don't raise on any warnings.

        Default is "release".
    depth : int, optional
        If `package` is None, then this can be used to initialize from the
        module of the caller of (the caller of (...)) the code that
        initializes `NoseTester`. Default of 0 means the module of the
        immediate caller; higher values are useful for utility routines that
        want to initialize `NoseTester` objects on behalf of other code.

    N�releaserFcCs�|durd}d}|dur.t�d|�}|j�dd�}|dur t�tj�|�}|j�dd�}nt|t	t��rCtj�|j
�}t|dd�}nt|�}||_
|durRt|�}||_||_||_dS)Nr+rr�__name__)r!r"r#r$r%rr�dirname�
isinstance�typer�getattr�str�package_pathr�package_name�raise_warnings�check_fpu_mode)�self�packager4�depthr5r3r)r2rrr�__init__�s(

zNoseTester.__init__cCslt|jdg}|r!|dkr!t|t�std��|dkrd}|d|g7}|dt|�g7}|dg7}|r4||7}|S)	a Generate argv for nosetest command

        Parameters
        ----------
        label : {'fast', 'full', '', attribute identifier}, optional
            see ``test`` docstring
        verbose : int, optional
            Verbosity value for test outputs, in the range 1-10. Default is 1.
        extra_argv : list, optional
            List with any extra arguments to pass to nosetests.

        Returns
        -------
        argv : list
            command line arguments that will be passed to nose
        z-s�fullz"Selection label should be a string�fastznot slowz-Az--verbosityz--exe)rr2r.r1�	TypeError)r6�label�verbose�
extra_argvrrrr�
_test_argv�s

zNoseTester._test_argvcCs�t�}ddl}td|j���|jddd�jj}td|�tj�	|j
�}td|���d|jvrJddl}td	|j���tj�	|j
�}td
|���t
j�dd�}td
|���td|j�dS)NrzNumPy version )�
r�C)�orderz&NumPy relaxed strides checking option:zNumPy is installed in rzSciPy version zSciPy is installed in �
�zPython version znose version %d.%d.%d)rr�print�__version__�ones�flags�f_contiguousrrr-rr3rr!�version�replace�__versioninfo__)r6r*r�relaxed_strides�npdirr�spdir�	pyversionrrr�_show_system_info�s

zNoseTester._show_system_infocCsddlm}|�S)z� Return instantiated plugin for doctests

        Allows subclassing of this class to override doctester

        A return value of None means use the nose builtin doctest plugin
        r)�NumpyDoctest)r&rS)r6rSrrr�_get_custom_doctester�sz NoseTester._get_custom_doctesterr;rcCs~t�|�|||�}|r|d|j��dddg7}|r2|dur$|dg7}nt|t�r2|ddt|�g7}dd	l}dd
lm}	ddl	m
}
m}m}|
�g}
|
d
d�|j
jj
D�7}
|jrd|
|�g7}
|dg7}z|	�}|��|
dd�|j
D�7}
Wn	ty�Ynwd|v}|dkr�|r�d}|��}|d	ur�|r�|s�|dg7}||
fS|r�|�d�|
|d�|g7}
|r�|d|jg7}||
fS)z�
        Run tests for module using nose.

        This method does the heavy lifting for the `test` method. It takes all
        the same arguments, for details see `test`.

        See Also
        --------
        test

        z--cover-package=z--with-coveragez
--cover-testsz
--cover-eraseTz--with-timerz
--timer-top-nrN)�EntryPointPluginManagerr)r�	Unplugger�FPUModeCheckPlugincSsg|]}|��qSrr��.0�prrr�
<listcomp>(sz0NoseTester.prepare_test_args.<locals>.<listcomp>z--with-fpumodecheckplugincSsg|]}|�qSrrrXrrrr[0sz--with-doctestF�doctestz--with-)rr@r3r.�intr1�nose.plugins.builtin�nose.pluginsrUr&rrVrW�plugins�builtinr5�loadPlugins�ImportErrorrT�remove�name)r6r=r>r?�doctests�coverage�timerrr*rUrrVrWr`�entrypoint_manager�doctest_argv�plugrrr�prepare_test_argssP�

�
�
zNoseTester.prepare_test_argsc	Cs�t|d�}ddlm}||_|�||||||�\}	}
|r%td|j���ntd|j���|��ddl}d|_	|dur?|j
}ttfdd	�}t
|t�rO||}td
���}
t��t�d�|D]	}tjd|d
�q_|
jdd�|
jdd�|
jdd�|
jtjd
�|
jdd�|
jdd�t���t�d�ddlm}Wd�n1s�wY|
jt|d�tjddtdd�ddlm}||	d|
d�}Wd�|jS1s�wY|jS)a�	
        Run tests for module using nose.

        Parameters
        ----------
        label : {'fast', 'full', '', attribute identifier}, optional
            Identifies the tests to run. This can be a string to pass to
            the nosetests executable with the '-A' option, or one of several
            special values.  Special values are:

            * 'fast' - the default - which corresponds to the ``nosetests -A``
              option of 'not slow'.
            * 'full' - fast (as above) and slow tests as in the
              'no -A' option to nosetests - this is the same as ''.
            * None or '' - run all tests.
            * attribute_identifier - string passed directly to nosetests as '-A'.

        verbose : int, optional
            Verbosity value for test outputs, in the range 1-10. Default is 1.
        extra_argv : list, optional
            List with any extra arguments to pass to nosetests.
        doctests : bool, optional
            If True, run doctests in module. Default is False.
        coverage : bool, optional
            If True, report coverage of NumPy code. Default is False.
            (This requires the
            `coverage module <https://pypi.org/project/coverage/>`_).
        raise_warnings : None, str or sequence of warnings, optional
            This specifies which warnings to configure as 'raise' instead
            of being shown once during the test execution. Valid strings are:

            * "develop" : equals ``(Warning,)``
            * "release" : equals ``()``, do not raise on any warnings.
        timer : bool or int, optional
            Timing of individual tests with ``nose-timer`` (which needs to be
            installed).  If True, time tests and report on all of them.
            If an integer (say ``N``), report timing results for ``N`` slowest
            tests.

        Returns
        -------
        result : object
            Returns the result of running the tests as a
            ``nose.result.TextTestResult`` object.

        Notes
        -----
        Each NumPy module exposes `test` in its namespace to run all tests for it.
        For example, to run all tests for numpy.lib:

        >>> np.lib.test() #doctest: +SKIP

        Examples
        --------
        >>> result = np.lib.test() #doctest: +SKIP
        Running unit tests for numpy.lib
        ...
        Ran 976 tests in 3.933s

        OK

        >>> result.errors #doctest: +SKIP
        []
        >>> result.knownfail #doctest: +SKIP
        []
        �r)�utilsz$Running unit tests and doctests for zRunning unit tests for rNr)�developr+�location�always�error)�categoryzNot importing directory)�messageznumpy.dtype size changedznumpy.ufunc size changedz.*boolean negative.*z.*boolean subtract.*)�cpuinfo)rs�module�ignorez.*getargspec.*znose\.)rtrsrv)�NumpyTestProgramF)r�exitr`)�minrErnr>rlrFr3rRr\�masterr4�dict�Warningr.r1r�warnings�
resetwarnings�filterwarnings�filter�np�ModuleDeprecationWarning�catch_warnings�simplefilter�	distutilsru�UserWarning�DeprecationWarningr&rx�result)r6r=r>r?rfrgr4rhrnrr`r\�
_warn_opts�sup�warningtyperurx�trrr�testFsZ
G��




��
�'�'zNoseTester.testcCsbtd|j���|��|�|||�}|ddtjg7}t�}ddlm}|d�g}|j	||d�S)a�
        Run benchmarks for module using nose.

        Parameters
        ----------
        label : {'fast', 'full', '', attribute identifier}, optional
            Identifies the benchmarks to run. This can be a string to pass to
            the nosetests executable with the '-A' option, or one of several
            special values.  Special values are:

            * 'fast' - the default - which corresponds to the ``nosetests -A``
              option of 'not slow'.
            * 'full' - fast (as above) and slow benchmarks as in the
              'no -A' option to nosetests - this is the same as ''.
            * None or '' - run all tests.
            * attribute_identifier - string passed directly to nosetests as '-A'.

        verbose : int, optional
            Verbosity value for benchmark outputs, in the range 1-10. Default is 1.
        extra_argv : list, optional
            List with any extra arguments to pass to nosetests.

        Returns
        -------
        success : bool
            Returns True if running the benchmarks works, False if an error
            occurred.

        Notes
        -----
        Benchmarks are like tests, but have names starting with "bench" instead
        of "test", and can be found under the "benchmarks" sub-directory of the
        module.

        Each NumPy module exposes `bench` in its namespace to run all benchmarks
        for it.

        Examples
        --------
        >>> success = np.lib.bench() #doctest: +SKIP
        Running benchmarks for numpy.lib
        ...
        using 562341 items:
        unique:
        0.11
        unique1d:
        0.11
        ratio: 1.0
        nUnique: 56230 == 56230
        ...
        OK

        >>> success #doctest: +SKIP
        True

        zRunning benchmarks for z--matchz(?:^|[\\b_\\.%s-])[Bb]enchr)rVr\r)
rFr3rRr@r�seprr&rVr')r6r=r>r?rr*rV�add_pluginsrrr�bench�s:
zNoseTester.bench)Nr+rF)r;rNFFF)r;rNFFNF)r;rN)r,�
__module__�__qualname__�__doc__r9r@rRrTrlr�r�rrrrrps")
�)%

�@
�rcCs,ttd�r
dtjvr
d}nd}t|ddd�S)NrGz.dev0ror+rT)r4r8r5)�hasattrr�rGr)�moderrrrs�r)NN)r�rr!r~rr�rnrr�__all__rrrrrrrr�<module>s
)3.