%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyc

�
�9Zc@`s�dZddlmZmZmZddlZddlZddlZddlm	Z	ddl
Zd�Zd�Z
eed�Zdefd	��YZd
�ZdS(se
Nose test running.

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

i(tdivisiontabsolute_importtprint_functionN(t
basestringcC`s�|}g}xQd|ks(d|kr`tjj|�\}}|dkrPPn|j|�qW|s~d|krwdSdSn|j�|djd�r�|jd�ndj|�S(	s&
    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'

    s
site-packagess
dist-packagestscipytnumpyis.eggt.(s
site-packagess
dist-packages(tostpathtsplittappendtreversetendswithtpoptjoin(tfilepathtfullpathtpkg_nametp2((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pytget_package_names
cC`sqt}d}yddl}Wntk
r5t}nX|j|krNt}n|smd|}t|��n|S(s# Import nose only when needed.
    iiNsWNeed nose >= %d.%d.%d for tests - see http://somethingaboutorange.com/mrl/projects/nose(iii(tTruetnosetImportErrortFalset__versioninfo__(t	fine_nosetminimum_nose_versionRtmsg((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pytimport_nose8s

	cC`s�|dkrHtjd�}|jjdd�}|dkrHt�qHn|dkrgtj|g}n
||g}t�}ddlm	}|j
d|d|�g�dS(s�
    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'.
    it__file__(tKnownFailurePlugintargvt
addpluginsN(tNonetsyst	_getframetf_localstgettAssertionErrorRRtnoseclassesRtrun(tfile_to_runRtfRR((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pytrun_module_suiteMs#
	t
NoseTestercB`s�eZdZdddd�Zd�Zd�Zd�Zdddeed	�Z	dddeedd
�Z
dddd�ZRS(
s�
    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 'warn' during the test execution.  Valid strings are:

          - "develop" : equals ``(DeprecationWarning, RuntimeWarning)``
          - "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.

    treleaseicC`s|dkrd}nd}|dkr�tjd|�}|jjdd�}|dkrdt�ntjj|�}|jjdd�}nKt	|t
t��r�tjj|j�}t|dd�}nt
|�}||_|dkr�t|�}n||_||_dS(NR-iRt__name__(R!R"R#R$R%R&RRtdirnamet
isinstancettypeRtgetattrtstrtpackage_pathRtpackage_nametraise_warnings(tselftpackageR6tdepthR5R*R4((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt__init__�s&					cC`s�t|jdg}|rj|dkrjt|t�sBtd��n|dkrWd}n|d|g7}n|dt|�g7}|dg7}|r�||7}n|S(	s 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
        s-stfulls"Selection label should be a stringtfastsnot slows-As--verbositys--exe(RR4R0Rt	TypeErrorR3(R7tlabeltverboset
extra_argvR((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt
_test_argv�s	

cC`s�t�}ddl}td|j�|jddd�jj}td|�tjj	|j
�}td|�d	|jkr�ddl}td
|j�tjj	|j
�}td|�nt
jjdd
�}td|�td|j�dS(NisNumPy version %si
itordertCs&NumPy relaxed strides checking option:sNumPy is installed in %sRsSciPy version %ssSciPy is installed in %ss
tsPython version %ssnose version %d.%d.%d(i
i(RRtprintt__version__tonestflagstf_contiguousRRR/RR5RR"tversiontreplaceR(R7RRtrelaxed_stridestnpdirRtspdirt	pyversion((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt_show_system_info�s	
cC`sddlm}|�S(s� 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
        i(tNumpyDoctest(R'RQ(R7RQ((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt_get_custom_doctestersR<icC`sKt�|j|||�}|rB|d|jdddg7}nddl}ddlm}m}	|�g}
|
g|jjjD]}|�^q�7}
d	|k}|t	kr�|r�t
}n|j�}
|
dkr�|rA|rA|d	g7}qAnI|r|j
d	�n|
|	d
�|
g7}
|rA|d|
jg7}n||
fS(s�
        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

        s--cover-package=%ss--with-coverages
--cover-testss
--cover-eraseiNi(Rt	Unpluggers--with-doctesttdoctests--with-(RRAR5tnose.plugins.builtinR'RRStpluginstbuiltinRRRRR!tremovetname(R7R>R?R@tdocteststcoverageRRRRSRVtptdoctest_argvtplug((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pytprepare_test_argss,)	
cC`s	t|d�}ddlm}||_|rBtd|j�ntd|j�|j�ddl}d|_	|dkr�|j
}ntdtt
fd	d�}	t|t�r�|	|}ntj��3tj�tjd
�x!|D]}
tjdd|
�q�Wtjd
dd�tjd
dd�tjd
dd�tjd
dtj�tjd
dt�tjd
dd�tjd
dd�tjd
dddtdd�ddlm}|j|||||�\}}
|d|dtd|
�}WdQX|jS(s�
        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 : str or sequence of warnings, optional
            This specifies which warnings to configure as 'raise' instead
            of 'warn' during the test execution.  Valid strings are:

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

        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
        []
        ii(tutilss&Running unit tests and doctests for %ssRunning unit tests for %siNtdevelopR-talwaysterrortcategorytignoretmessagesNot importing directorysnumpy.dtype size changedsnumpy.ufunc size changeds.*boolean negative.*s.*boolean subtract.*s.*getargspec.*tmodulesnose\.(tNumpyTestProgramRtexitRV((tminRDR`R?RER5RPRTR!tmasterR6tdicttDeprecationWarningtRuntimeWarningR0Rtwarningstcatch_warningst
resetwarningstfilterwarningstnptModuleDeprecationWarningt
FutureWarningR'RhR_Rtresult(R7R>R?R@RZR[R6R`RTt
_warn_optstwarningtypeRhRRVtt((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyttest=sF@	
		




!cC`s�td|j�|j�|j|||�}|ddtjg7}t�}ddlm}|d�g}|j	d|d|�S(	s�
        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

        sRunning benchmarks for %ss--matchs(?:^|[\\b_\\.%s-])[Bb]enchi(RSRTRR (
RER5RPRARtsepRR'RSR((R7R>R?R@RRRStadd_plugins((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pytbench�s8
	N(R.t
__module__t__doc__R!R:RARPRRRR_RzR}(((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyR,�s)%	%		
	*	ycC`s@ttd�r'dtjkr'd}nd}td|dd�S(NRFs.dev0RaR-R6R9i(thasattrRsRFR,(tmode((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt
_numpy_tester�s	(Rt
__future__RRRRR"Rotnumpy.compatRRRsRRR!R+tobjectR,R�(((sK/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt<module>s	(	3��

Zerion Mini Shell 1.0