• File: nosetester.cpython-37.opt-1.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib64/python3.7/site-packages/numpy/testing/__pycache__/nosetester.cpython-37.opt-1.pyc
  • Date Modified: 04/24/2023 7:10 PM
  • File size: 14.23 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

<FdJ@sdZddlmZmZmZddlZddlZddlZddlm	Z	ddl
Zddlm
Z
mZddZdd	d
ZGdddeZd
dZdS)ze
Nose test running.

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

)divisionabsolute_importprint_functionN)
basestring)import_nosesuppress_warningscCs|dd}g}x8d|ks"d|krHtj|\}}|dkr<P||qW|s^d|krZdSdS||ddr~|dd	|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'

    Nz
site-packagesz
dist-packages)z
site-packagesz
dist-packagesscipynumpyrz.egg.)ospathsplitappendreverseendswithpopjoin)filepathZfullpathZpkg_nameZp2rK/opt/alt/python37/lib64/python3.7/site-packages/numpy/testing/nosetester.pyget_package_names
rcCst|dkr,td}|jdd}|dkr,t|dkrBtj|g}n
||g}t}ddlm}|j	||gddS)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")

    from an interpreter will run all the test routine in 'test_matlib.py'.
    Nr__file__)KnownFailurePlugin)argv
addplugins)
sys	_getframef_localsgetAssertionErrorrrnoseclassesrrun)Zfile_to_runrfnoserrrrrun_module_suite;s#

r%c@sPeZdZdZdddZddZd	d
ZddZdddZdddZ	dddZ
dS)
NoseTestera
    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.

    NreleasercCs|dkrd}d}|dkr\td|}|jdd}|dkr@ttj|}|jdd}n2t|t	trtj|j
}t|dd}nt|}||_
|dkrt|}||_||_dS)Nr'rr__name__)rrrrr rr
dirname
isinstancetypergetattrstrpackage_pathrpackage_nameraise_warnings)selfpackager0depthr/r#r.rrr__init__s&	zNoseTester.__init__cCslt|jdg}|rB|dkrBt|ts*td|dkr6d}|d|g7}|dt|g7}|dg7}|rh||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-sZfullz"Selection label should be a stringfastznot slowz-Az--verbosityz--exe)rr.r*r	TypeErrorr-)r1labelverbose
extra_argvrrrr
_test_argvs

zNoseTester._test_argvcCst}ddl}td|j|jdddjj}td|tj	|j
}td|d|jkrddl}td	|jtj	|j
}td
|t
jdd}td
|td|jdS)NrzNumPy version %s)
rC)orderz&NumPy relaxed strides checking option:zNumPy is installed in %sr	zSciPy version %szSciPy is installed in %s
zPython version %sznose version %d.%d.%d)rr
print__version__Zonesflagsf_contiguousrr
r)rr/r	rversionreplaceZ__versioninfo__)r1r$r
Zrelaxed_stridesZnpdirr	ZspdirZ	pyversionrrr_show_system_infos

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!rG)r1rGrrr_get_custom_doctestersz NoseTester._get_custom_doctesterr5rFc
Cst||||}|r.|d|jdddg7}ddl}ddlm}m}	|g}
|
d	d
|jjjD7}
d|k}|dkr~|r~d
}|	}|dkr|r|s|dg7}n2|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=%sz--with-coveragez
--cover-testsz
--cover-eraserNr)r	UnpluggercSsg|]
}|qSrr).0prrr
<listcomp>sz0NoseTester.prepare_test_args.<locals>.<listcomp>z--with-doctestFTdoctestz--with-)rr:r/Znose.plugins.builtinr!rrIpluginsZbuiltinrHremovename)
r1r7r8r9doctestscoveragerr$rrIrNZdoctest_argvZplugrrrprepare_test_argss,

zNoseTester.prepare_test_argsc
Cst|d}ddlm}||_|r0td|jntd|j|ddl}d|_|dkrb|j	}t
tfdd	}	t|t
r|	|}td
l}
ttdx|D]}tjd|d
qW|
jdd|
jdd|
jdd|
jtjd
|
jdd|
jddttdddlm}WdQRX|
jt|dtjjdkrtjrddl}
|
jtd|
d|
jtdd|
jtdd|
jtdd|
jtdd|
jtddtjddtd d!dd"l m!}|"|||||\}}||d#|d$}WdQRX|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:
             <http://nedbatchelder.com/code/modules/coverage.html>`_).
        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.

            The default is to use the class initialization value.

        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 %szRunning unit tests for %srNr)developr'locationalwayserror)categoryzNot importing directory)messageznumpy.dtype size changedznumpy.ufunc size changedz.*boolean negative.*z.*boolean subtract.*)cpuinfo)rZmodulez(sys\.exc_clear\(\) not supported in 3\.x)r^zin 3\.x, __setslice__zin 3\.x, __getslice__z buffer\(\) not supported in 3\.xz%CObject type is not supported in 3\.xz-comparing unequal types not supported in 3\.xignorez.*getargspec.*znose\.)r[rZr^)NumpyTestProgramF)rexitrN)$minr?rUr8r@r/rFrMZmasterr0dictWarningr*rrwarnings
resetwarningsfilterwarningsfilternpZModuleDeprecationWarningcatch_warningssimplefilterZ	distutilsr]UserWarningrversion_infomajorZpy3kwarning	threadingDeprecationWarningr!r`rSresult)r1r7r8r9rQrRr0rUrMZ
_warn_optsZsupZwarningtyper]ror`rrNtrrrtest+s`A





zNoseTester.testcCs`td|j|||||}|ddtjg7}t}ddlm}|dg}|j	||dS)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 %sz--matchz(?:^|[\\b_\\.%s-])[Bb]enchr)rIrM)rr)
r@r/rFr:rseprr!rIr")r1r7r8r9rr$rIZadd_pluginsrrrbenchs8
zNoseTester.bench)Nr'r)r5rNFF)r5rNFFN)r5rN)r(
__module____qualname____doc__r4r:rFrHrSrsrurrrrr&ns)
%%

*
r&cCs*ttdrdtjkrd}nd}t|ddS)NrAz.dev0rVr'r)r0r3)hasattrrirAr&)moderrr
_numpy_testersr{)NN)rxZ
__future__rrrrrreZnumpy.compatrr
rirUrrrr%objectr&r{rrrr<module>s)
3