§
    €ÛgëK  ã                   óp   — d Z ddlZddlZddlZddlZddlmZmZ g d¢Z	d„ Z
dd„Z G d„ d	¦  «        Zd
„ ZdS )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_testerr   r   r   c                 óx  — | dd…         }g }d| v sd| v rDt           j                             | ¦  «        \  } }|dv rn|                     |¦  «         d| v °@d| v °D|sd|v rdS dS |                     ¦   «          |d                              d¦  «        r|                     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Únumpyr   z.eggú.)ÚosÚpathÚsplitÚappendÚreverseÚendswithÚpopÚjoin)ÚfilepathÚfullpathÚpkg_nameÚp2s       úW/granary/edev/quantum/lib/python3.11/site-packages/numpy/testing/_private/nosetester.pyr   r      sê   € ð  ˜˜˜Œ{€HØ€HØ
˜XÐ
%Ð
%¨¸HÐ)DÐ)DÝ”w—}’} XÑ.Ô.‰ˆ�"ØÐ3Ð3Ð3ØØ�Š˜ÑÔÐð	 ˜XÐ
%Ð
%¨¸HÐ)DÐ)Dð ð Ø�hÐÐØ�7à�7ð ×ÒÑÔÐð �„{×Ò˜FÑ#Ô#ð Ø�Š�Q‰Œˆà�8Š8�HÑÔÐó    c                 ó  — | €8t          j        d¦  «        }|j                             dd¦  «        } | €t          ‚|€t           j        | gz   }n|| gz   }t          ¦   «         }ddlm} | 	                    | |¦   «         g¬¦  «         dS )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ÚAssertionErrorr"   r   Únoseclassesr    Úrun)Úfile_to_runr"   ÚfÚnoser    s        r   r   r   =   s    € ðF ÐÝŒM˜!ÑÔˆØ”j—n’n Z°Ñ6Ô6ˆØÐÝ Ð à€|ÝŒx˜;˜-Ñ'ˆˆà�{�mÑ#ˆå‰=Œ=€DØ/Ð/Ð/Ð/Ð/Ð/Ø‡H‚H�$Ð$6Ð$6Ñ$8Ô$8Ð#9€HÑ:Ô:Ð:Ð:Ð:r   c                   óR   — e Zd ZdZ	 	 dd„Zd„ Zd„ Zd	„ Z	 	 dd„Z	 	 	 dd„Z	dd„Z
dS )r   aï  
    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Úreleaser   Fc                 ó*  — |€d}d }|€vt          j        d|z   ¦  «        }|j                             dd ¦  «        }|€t          ‚t
          j                             |¦  «        }|j                             dd ¦  «        }ngt          |t          t
          ¦  «        ¦  «        r6t
          j                             |j
        ¦  «        }t          |dd ¦  «        }nt          |¦  «        }|| _        |€t          |¦  «        }|| _        || _        || _        d S )Nr/   r   r   Ú__name__)r$   r%   r&   r'   r(   r   r   ÚdirnameÚ
isinstanceÚtyper   ÚgetattrÚstrÚpackage_pathr   Úpackage_nameÚraise_warningsÚcheck_fpu_mode)ÚselfÚpackager9   Údepthr:   r8   r,   r7   s           r   Ú__init__zNoseTester.__init__š   s  € ð Ð!Ø&ˆNàˆØˆ?Ý”˜a %™iÑ(Ô(ˆAØœ:Ÿ>š>¨*°dÑ;Ô;ˆLØÐ#Ý$Ð$Ýœ7Ÿ?š?¨<Ñ8Ô8ˆLØœ:Ÿ>š>¨*°dÑ;Ô;ˆLˆLÝ˜¥¥b¡¤Ñ*Ô*ð 	(Ýœ7Ÿ?š?¨7Ô+;Ñ<Ô<ˆLÝ" 7¨J¸Ñ=Ô=ˆLˆLå˜w™<œ<ˆLà(ˆÔð ÐÝ+¨LÑ9Ô9ˆLØ(ˆÔð -ˆÔð -ˆÔÐÐr   c                 óÜ   — t           | j        dg}|r9|dk    r3t          |t          ¦  «        st	          d¦  «        ‚|dk    rd}|d|gz  }|dt          |¦  «        gz  }|dgz  }|r||z  }|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Úfastznot slowz-Az--verbosityz--exe)r   r7   r3   r6   Ú	TypeError)r;   ÚlabelÚverboseÚ
extra_argvr"   s        r   Ú
_test_argvzNoseTester._test_argvÃ   s›   € õ" ˜$Ô+¨TÐ2ˆØð 	"�U˜f’_�_Ý˜e¥SÑ)Ô)ð FÝÐ DÑEÔEÐEØ˜ŠˆØ"�Ø�T˜5�MÑ!ˆDØ�¥ G¡¤Ð-Ñ-ˆð 	��	Ñˆàð 	Ø�JÑˆDØˆr   c                 ól  — t          ¦   «         }dd l}t          d|j        › �¦  «         |                     dd¬¦  «        j        j        }t          d|¦  «         t          j         	                    |j
        ¦  «        }t          d|› �¦  «         d| j        v rQdd l}t          d	|j        › �¦  «         t          j         	                    |j
        ¦  «        }t          d
|› �¦  «         t          j                             dd¦  «        }t          d|› �¦  «         t          d|j        z  ¦  «         d S )Nr   zNumPy version )é
   r   ÚC)Úorderz&NumPy relaxed strides checking option:zNumPy is installed in r   zSciPy version zSciPy is installed in ú
Ú zPython version znose version %d.%d.%d)r   r   ÚprintÚ__version__ÚonesÚflagsÚf_contiguousr   r   r2   r   r8   r   r$   ÚversionÚreplaceÚ__versioninfo__)r;   r-   r   Úrelaxed_stridesÚnpdirr   ÚspdirÚ	pyversions           r   Ú_show_system_infozNoseTester._show_system_infoè   s.  € Ý‰}Œ}ˆàˆˆˆÝÐ2˜uÔ0Ð2Ð2Ñ3Ô3Ð3ØŸ*š* W°C˜*Ñ8Ô8Ô>ÔKˆÝÐ6¸ÑHÔHÐHÝ”—’ ¤Ñ/Ô/ˆÝÐ. uÐ.Ð.Ñ/Ô/Ð/à�dÔ'Ð'Ð'ØˆLˆLˆLÝÐ6 5Ô#4Ð6Ð6Ñ7Ô7Ð7Ý”G—O’O E¤NÑ3Ô3ˆEÝÐ2¨5Ð2Ð2Ñ3Ô3Ð3å”K×'Ò'¨¨bÑ1Ô1ˆ	ÝÐ+ 	Ð+Ð+Ñ,Ô,Ð,ÝÐ%¨Ô(<Ñ<Ñ=Ô=Ð=Ð=Ð=r   c                 ó"   — ddl m}  |¦   «         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)   r[   )r;   r[   s     r   Ú_get_custom_doctesterz NoseTester._get_custom_doctesterü   s"   € ð 	.Ð-Ð-Ð-Ð-Ð-Øˆ|‰~Œ~Ðr   rA   r   c                 óì  — t          ¦   «          |                      |||¦  «        }|r|d| j        › �dddgz  }|r5|du r|dgz  }n*t          |t          ¦  «        r|ddt          |¦  «        gz  }dd	l}dd
lm}	 ddl	m
}
m}m}  |
¦   «         g}|d„ |j        j        j        D ¦   «         z  }| j        r| |¦   «         gz  }|dgz  }	  |	¦   «         }|                     ¦   «          |d„ |j        D ¦   «         z  }n# t"          $ r Y nw xY wd|v }|dk    r|rd}|                      ¦   «         }|€|r|s|dgz  }n7|r|                     d¦  «         | |d¦  «        |gz  }|r|d|j        z   gz  }||fS )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-nr   N)ÚEntryPointPluginManagerr   )r    Ú	UnpluggerÚFPUModeCheckPluginc                 ó"   — g | ]} |¦   «         ‘ŒS © rb   ©Ú.0Úps     r   ú
<listcomp>z0NoseTester.prepare_test_args.<locals>.<listcomp>(  s   € Ð>Ð>Ð>˜A�A�A‘C”CÐ>Ð>Ð>r   z--with-fpumodecheckpluginc                 ó   — g | ]}|‘ŒS rb   rb   rc   s     r   rf   z0NoseTester.prepare_test_args.<locals>.<listcomp>0  s   € Ð>Ð>Ð>˜a˜Ð>Ð>Ð>r   z--with-doctestFÚdoctestz--with-)r   rF   r8   r3   Úintr6   Únose.plugins.builtinÚnose.pluginsr^   r)   r    r_   r`   ÚpluginsÚbuiltinr:   ÚloadPluginsÚImportErrorr\   ÚremoveÚname)r;   rC   rD   rE   ÚdoctestsÚcoverageÚtimerr"   r-   r^   r    r_   r`   rl   Úentrypoint_managerÚdoctest_argvÚplugs                    r   Úprepare_test_argszNoseTester.prepare_test_args  sd  € õ 	‰Œˆà�Š˜u g¨zÑ:Ô:ˆàð 	5ØÐ;¨Ô(9Ð;Ð;Ð=NØ" Oð5ñ 5ˆDð ð 	FØ˜ˆ}ˆ}Ø˜Ð(Ñ(��Ý˜E¥3Ñ'Ô'ð FØ˜¨½#¸e¹*¼*ÐEÑE�ð 	$Ð#Ð#Ð#Ø8Ð8Ð8Ð8Ð8Ð8ð	6ð 	6ð 	6ð 	6ð 	6ð 	6ð 	6ð 	6ð 	6ð 	6à%Ð%Ñ'Ô'Ð(ˆØÐ>Ð> ¤Ô!5Ô!=Ð>Ñ>Ô>Ñ>ˆØÔð 	2ØÐ*Ð*Ñ,Ô,Ð-Ñ-ˆGØÐ0Ð1Ñ1ˆDð	à!8Ð!8Ñ!:Ô!:ÐØ×*Ò*Ñ,Ô,Ð,ØÐ>Ð>Ð#5Ô#=Ð>Ñ>Ô>Ñ>ˆGˆGøÝð 	ð 	ð 	àˆDð	øøøð
 (¨4Ð/ˆØ�uÒÐ ÐØˆHØ×)Ò)Ñ+Ô+ˆØˆ<àð + ð +ØÐ)Ð*Ñ*�øàð .Ø—’Ð,Ñ-Ô-Ð-Ø˜	˜	 )Ñ,Ô,¨dÐ3Ñ3ˆGØð 0Ø˜ T¤YÑ.Ð/Ñ/�Ø�Wˆ}Ðs   Ã	2C< Ã<
D	ÄD	c                 ó°  — t          |d¦  «        }ddlm} ||_        |                      ||||||¦  «        \  }	}
|rt          d| j        › �¦  «         nt          d| j        › �¦  «         |                      ¦   «          ddl}d|_	        |€| j
        }t          t          fd¬	¦  «        }t          |t          ¦  «        r||         }t          d
¦  «        5 }t!          j        ¦   «          t!          j        d¦  «         |D ]}t!          j        d|¬¦  «         Œ|                     d¬¦  «         |                     d¬¦  «         |                     d¬¦  «         |                     t(          j        ¬¦  «         |                     d¬¦  «         |                     d¬¦  «         t!          j        ¦   «         5  t!          j        d¦  «         ddlm} ddd¦  «         n# 1 swxY w Y   |                     t4          |¬¦  «         t!          j        ddt6          d¬¦  «         ddlm}  ||	d|
¬¦  «        }ddd¦  «         n# 1 swxY w Y   |j        S )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 zRunning unit tests for r   Nrb   )Údevelopr/   ÚlocationÚalwaysÚerror)ÚcategoryzNot importing directory)Úmessageznumpy.dtype size changedznumpy.ufunc size changedz.*boolean negative.*z.*boolean subtract.*)Úcpuinfo)r€   ÚmoduleÚignorez.*getargspec.*znose\.)r�   r€   rƒ   )ÚNumpyTestProgramF)r"   Úexitrl   )ÚminrL   r{   rD   rx   rM   r8   rY   rh   Úmasterr9   ÚdictÚWarningr3   r6   r   ÚwarningsÚresetwarningsÚfilterwarningsÚfilterÚnpÚModuleDeprecationWarningÚcatch_warningsÚsimplefilterÚ	distutilsr‚   ÚUserWarningÚDeprecationWarningr)   r…   Úresult)r;   rC   rD   rE   rr   rs   r9   rt   r{   r"   rl   rh   Ú
_warn_optsÚsupÚwarningtyper‚   r…   Úts                     r   ÚtestzNoseTester.testF  s<  € õN �g˜q‘/”/ˆàÐÐÐÐÐØˆŒà×.Ò.Ø�w 
¨H°hÀñGô G‰ˆˆgð ð 	AÝÐL¸Ô9JÐLÐLÑMÔMÐMÐMåÐ?¨DÔ,=Ð?Ð?Ñ@Ô@Ð@à×ÒÑ Ô Ð ð 	ˆˆˆØˆŒàÐ!Ø!Ô0ˆNå¥7 *Ø"$ð&ñ &ô &ˆ
å�n¥cÑ*Ô*ð 	8Ø'¨Ô7ˆNå˜zÑ*Ô*ð %	I¨cõ Ô"Ñ$Ô$Ð$õ Ô# HÑ-Ô-Ð-à-ð Gð G�ÝÔ'¨¸+ÐFÑFÔFÐFÐFà�JŠJÐ8ˆJÑ9Ô9Ð9Ø�JŠJÐ9ˆJÑ:Ô:Ð:Ø�JŠJÐ9ˆJÑ:Ô:Ð:Ø�JŠJ¥Ô ;ˆJÑ<Ô<Ð<ð �JŠJÐ5ˆJÑ6Ô6Ð6Ø�JŠJÐ5ˆJÑ6Ô6Ð6õ Ô(Ñ*Ô*ð 1ð 1ÝÔ% hÑ/Ô/Ð/Ø0Ð0Ð0Ð0Ð0Ð0ð1ð 1ð 1ñ 1ô 1ð 1ð 1ð 1ð 1ð 1ð 1øøøð 1ð 1ð 1ð 1ð �JŠJ¥°GˆJÑ<Ô<Ð<õ Ô# HÐ6FÝ-?Ø+4ð6ñ 6ô 6ð 6ð 6Ð5Ð5Ð5Ð5Ð5à Ð  d°ÀÐHÑHÔHˆAðK%	Ið %	Ið %	Iñ %	Iô %	Ið %	Ið %	Ið %	Ið %	Ið %	Ið %	Iøøøð %	Ið %	Ið %	Ið %	IðN Œxˆs8   ÃC$IÆ;G"ÇIÇ"G&	Ç&IÇ)G&	Ç*AIÉI
ÉI
c                 ó  — t          d| j        › �¦  «         |                      ¦   «          |                      |||¦  «        }|ddt          j        z  gz  }t          ¦   «         }ddlm}  |d¦  «        g}| 	                    ||¬¦  «        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

        zRunning benchmarks for z--matchz(?:^|[\\b_\\.%s-])[Bb]enchr   )r_   rh   r!   )
rM   r8   rY   rF   r   Úsepr   r)   r_   r*   )r;   rC   rD   rE   r"   r-   r_   Úadd_pluginss           r   ÚbenchzNoseTester.benchÑ  s¤   € õt 	Ð;¨Ô(9Ð;Ð;Ñ<Ô<Ð<Ø×ÒÑ Ô Ð à�Š˜u g¨zÑ:Ô:ˆØ�Ð9½B¼FÑBÐCÑCˆõ ‰}Œ}ˆð 	+Ð*Ð*Ð*Ð*Ð*Ø �y Ñ+Ô+Ð,ˆà�xŠx˜T¨kˆxÑ:Ô:Ð:r   )Nr/   r   F)rA   r   NFFF)rA   r   NFFNF)rA   r   N)r1   Ú
__module__Ú__qualname__Ú__doc__r>   rF   rY   r\   rx   r›   rŸ   rb   r   r   r   r   p   sÉ   € € € € € ð(ð (ðR FGØ %ð'-ð '-ð '-ð '-ðR#ð #ð #ðJ>ð >ð >ð(ð ð ð EIØ@Eð>ð >ð >ð >ð@ 8<Ø<@ØðIð Ið Ið IðVG;ð G;ð G;ð G;ð G;ð G;r   r   c                  óv   — t          t          d¦  «        rdt          j        v rd} nd} t          | dd¬¦  «        S )NrN   z.dev0r|   r/   r   T)r9   r=   r:   )Úhasattrr�   rN   r   )Úmodes    r   r	   r	     sJ   € Ý�r�=Ñ!Ô!ð  gµ´Ð&?Ð&?ØˆˆàˆÝ T°Ø%)ð+ñ +ô +ð +r   )NN)r¢   r   r$   r‹   r   r�   r{   r   r   Ú__all__r   r   r   r	   rb   r   r   ú<module>r§      sÐ   ððð ð 
€	€	€	Ø 
€
€
€
Ø €€€Ø Ð Ð Ð à 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1ð ð  ð  €ð
&ð &ð &ðR0;ð 0;ð 0;ð 0;ðfh;ð h;ð h;ð h;ð h;ñ h;ô h;ð h;ðV+ð +ð +ð +ð +r   