HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/numpy/tests/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/numpy/tests/__pycache__/test_public_api.cpython-36.pyc
3

���h}<�z@sjddlZddlZddlZddlZddlZddlZddlZddlZddlZyddl	Z	Wne
k
rldZ	YnXd�dd�Zdd�Zej
jdddg�d	d
��Zdd�Zd
d�Zdd�Zej
je	dkdd�dd��Zdd�d�D�ZdCdDdEgZdFd�d�D�Zd�d��Zd�d�d�d�d�d�d�d�d�d�g
Zd�dńZd�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�d�gZd�d�Zd�d�ZdS)��NcCsd|dkr|j}i}xLt|�D]@}t||�}t|d�rt|d�r|j|kr|jd|j||<qW|S)zEReturns a mapping of all objects with the wrong __module__ attribute.N�
__module__�__name__�.)r�dir�getattr�hasattrr)�module�module_name�results�name�item�r
�</tmp/pip-build-5_djhm0z/numpy/numpy/tests/test_public_api.py�	check_dirs

rcCsjdddddddddd	d
ddd
dddddddd�}ddddddddd�}t|f|�}tt�}||ksft�dS)Nz,numpy.testing._private.nosetester.NoseTesterz.numpy.core._multiarray_umath._add_newdoc_ufuncz*numpy.core._multiarray_umath.add_docstringz#numpy.core.function_base.add_newdocznumpy.lib.utils.byte_boundsz/numpy.core._multiarray_umath.compare_chararraysznumpy.lib.utils.deprecateznumpy.lib.utils.<lambda>znumpy.lib.function_base.dispz2numpy.core._multiarray_umath._fastCopyAndTransposez#numpy.lib.shape_base.get_array_wrapznumpy.lib.utils.get_includeznumpy.lib.npyio.mafromtxtznumpy.lib.npyio.ndfromtxtznumpy.lib.npyio.recfromcsvznumpy.lib.npyio.recfromtxtznumpy.lib.utils.safe_evalz)numpy.core.arrayprint.set_string_functionznumpy.__config__.showznumpy.lib.utils.who)�TesterZ_add_newdoc_ufuncZ
add_docstringZ
add_newdocZadd_newdoc_ufuncZbyte_boundsZcompare_chararraysZ	deprecateZdeprecate_with_docZdispZfastCopyAndTransposeZget_array_wrapZget_includeZ	mafromtxtZ	ndfromtxtZ
recfromcsvZ
recfromtxtZ	safe_evalZset_string_functionZshow_configZwhoz
builtins.boolzbuiltins.complexzbuiltins.floatzbuiltins.intzbuiltins.objectzbuiltins.str)�bool�complex�float�int�long�object�str�unicode)�dictr�np�AssertionError)Zundocumented�builtinsZ	whitelist�bad_resultsr
r
r�test_numpy_namespaces@rr�testingrcCs8tjdd|f}tj|�}|s$t�|tt�ks4t�dS)a�Make sure we can actually use the modules we lazy load.

    While not exported as part of the public API, it was accessible.  With the
    use of __getattr__ and __dir__, this isn't always true It can happen that
    an infinite recursion may happen.

    This is the only way I found that would force the failure to appear on the
    badly implemented code.

    We also test for the presence of the lazily imported modules in dir

    z-czimport numpy; numpy.N)�sys�
executable�
subprocess�check_outputrrr)rZexe�resultr
r
r�test_import_lazy_importKs

r%cCs$ttt��tttt���ks t�dS)zWAssert that output of dir has only one "testing/tester"
    attribute without duplicateN)�lenrr�setrr
r
r
r�test_dir_testingasr(cCsttj�}|ikst�dS)N)rr�linalgr)rr
r
r�test_numpy_linalggs
r*cCsttj�}|ikst�dS)N)rr�fftr)rr
r
r�test_numpy_fftls
r,z#ctypes not available in this python)�reasoncCs0tjtjjj�}t|dd�}|dks,td��dS)NZtest_not_exportedzG'test_not_exported' is mistakenly exported, NPY_NO_EXPORT does not work)�ctypes�CDLLr�coreZ_multiarray_tests�__file__rr)�cdll�fr
r
r�test_NPY_NO_EXPORTqsr4cCsg|]}d|�qS)znumpy.r
)�.0�sr
r
r�
<listcomp>�sr7�	ctypeslib�	distutils�distutils.cpuinfo�distutils.exec_command�distutils.misc_util�
distutils.log�distutils.system_info�doc�
doc.basics�doc.broadcasting�doc.byteswapping�
doc.constants�doc.creation�doc.dispatch�doc.glossary�doc.indexing�
doc.internals�doc.misc�doc.structured_arrays�doc.subclassing�
doc.ufuncs�dual�f2pyr+�lib�
lib.format�
lib.mixins�lib.recfunctions�lib.scimathr)�ma�	ma.extras�ma.mrecords�matlib�
polynomial�polynomial.chebyshev�polynomial.hermite�polynomial.hermite_e�polynomial.laguerre�polynomial.legendre�polynomial.polynomial�polynomial.polyutils�random�versionz
numpy.charznumpy.emathz	numpy.reccCsg|]}d|�qS)znumpy.r
)r5r6r
r
rr7�s�compat�compat.py3k�conftestr0�core.arrayprint�core.defchararray�core.einsumfunc�core.fromnumeric�core.function_base�core.getlimits�core.machar�core.memmap�core.multiarray�core.numeric�core.numerictypes�core.overrides�core.records�core.shape_base�
core.umath�core.umath_tests�distutils.ccompiler�distutils.command�distutils.command.autodist�distutils.command.bdist_rpm�distutils.command.build�distutils.command.build_clib�distutils.command.build_ext�distutils.command.build_py�distutils.command.build_scripts�distutils.command.build_src�distutils.command.config�!distutils.command.config_compiler�distutils.command.develop�distutils.command.egg_info�distutils.command.install�distutils.command.install_clib�distutils.command.install_data�!distutils.command.install_headers�distutils.command.sdist�distutils.conv_template�distutils.core�distutils.extension�distutils.fcompiler�distutils.fcompiler.absoft�distutils.fcompiler.compaq�distutils.fcompiler.environment�distutils.fcompiler.g95�distutils.fcompiler.gnu�distutils.fcompiler.hpux�distutils.fcompiler.ibm�distutils.fcompiler.intel�distutils.fcompiler.lahey�distutils.fcompiler.mips�distutils.fcompiler.nag�distutils.fcompiler.none�distutils.fcompiler.pathf95�distutils.fcompiler.pg�distutils.fcompiler.nv�distutils.fcompiler.sun�distutils.fcompiler.vast�distutils.from_template�distutils.intelccompiler�distutils.lib2def�distutils.line_endings�distutils.mingw32ccompiler�distutils.msvccompiler�distutils.npy_pkg_config�distutils.numpy_distribution�distutils.pathccompiler�distutils.unixccompiler�
f2py.auxfuncs�f2py.capi_maps�
f2py.cb_rules�f2py.cfuncs�f2py.common_rules�f2py.crackfortran�
f2py.diagnose�f2py.f2py2e�f2py.f2py_testing�f2py.f90mod_rules�f2py.func2subr�
f2py.rules�f2py.use_rules�
fft.helper�lib.arraypad�lib.arraysetops�lib.arrayterator�
lib.financial�lib.function_base�lib.histograms�lib.index_tricks�lib.nanfunctions�	lib.npyio�lib.polynomial�lib.shape_base�lib.stride_tricks�lib.twodim_base�lib.type_check�
lib.ufunclike�lib.user_array�	lib.utils�linalg.lapack_lite�
linalg.linalg�ma.bench�ma.core�ma.testutils�ma.timer_comparison�	matrixlib�matrixlib.defmatrix�
random.mtrand�random.bit_generator�testing.print_coercion_tables�
testing.utilscCsDd|ksd|ksd|krdS|tkr(dS|tkr4dS|tkr@dSdS)z%Check if this needs to be considered.z._z.testsz.setupFT)�PUBLIC_MODULES�PUBLIC_ALIASED_MODULES�PRIVATE_BUT_PRESENT_MODULES)rr
r
r�
is_unexpected4sr�znumpy.core.code_generatorsz!numpy.core.code_generators.genapiz)numpy.core.code_generators.generate_umathz+numpy.core.code_generators.ufunc_docstringsz-numpy.core.code_generators.generate_numpy_apiz-numpy.core.code_generators.generate_ufunc_apiz$numpy.core.code_generators.numpy_apiznumpy.core.cversionsznumpy.core.generate_numpy_apiznumpy.distutils.msvc9compilercCs\g}x@tjtjtjddd�D]$\}}}t|�r|tkr|j|�qW|rXtdj	|���dS)z|
    Test that we don't add anything that looks like a new public module by
    accident.  Check is based on filenames.
    rN)�path�prefix�onerrorzFound unexpected modules: {})
�pkgutil�
walk_packagesr�__path__rr��	SKIP_LIST�appendr�format)�modnames�_�modname�ispkgr
r
r�test_all_modules_are_expectedUs
r�z
numpy.mathznumpy.distutils.log.sysz numpy.distutils.system_info.copyz%numpy.distutils.system_info.distutilsznumpy.distutils.system_info.logznumpy.distutils.system_info.osz$numpy.distutils.system_info.platformznumpy.distutils.system_info.rez"numpy.distutils.system_info.shutilz&numpy.distutils.system_info.subprocessznumpy.distutils.system_info.sysz$numpy.distutils.system_info.tempfilez$numpy.distutils.system_info.textwrapz$numpy.distutils.system_info.warningsznumpy.doc.constants.reznumpy.doc.constants.textwrapznumpy.lib.emathznumpy.lib.mathznumpy.matlib.charznumpy.matlib.recznumpy.matlib.emathznumpy.matlib.mathznumpy.matlib.linalgznumpy.matlib.fftznumpy.matlib.randomznumpy.matlib.ctypeslibznumpy.matlib.macCsBdd�}|d�}xtD]}|j||��qW|r>tdj|���dS)a�
    Method checking all objects. The pkgutil-based method in
    `test_all_modules_are_expected` does not catch imports into a namespace,
    only filenames.  So this test is more thorough, and checks this like:

        import .lib.scimath as emath

    To check if something in a module is (effectively) public, one can check if
    there's anything in that namespace that's a public function/object but is
    not exposed in a higher-level namespace.  For example for a `numpy.lib`
    submodule::

        mod = np.lib.mixins
        for obj in mod.__all__:
            if obj in np.__all__:
                continue
            elif obj in np.lib.__all__:
                continue

            else:
                print(obj)

    cSs|g}tj|�}t|d�r |j}nt|�}xN|D]F}|jd�s.|d|}tt||�tj	�r.t
|�r.|tkr.|j|�q.W|S)N�__all__r�r)
�	importlib�
import_modulerr�r�
startswith�
isinstancer�types�
ModuleTyper��SKIP_LIST_2r�)�mod_name�membersrZobjnamesZobjnameZfullobjnamer
r
r�find_unexpected_members�s



z@test_all_modules_are_expected_2.<locals>.find_unexpected_members�numpyz5Found unexpected object(s) that look like modules: {}N)r��extendrr�)r�Zunexpected_membersr�r
r
r�test_all_modules_are_expected_2�s
r�cCs�dd�}g}xtD]}||�s|j|�qW|r>tdj|���x8tD]0}yt|�WqDtk
rr|j|�YqDXqDW|r�tdj|���tjdd��B}tj	dt
d�tj	dtd�xtD]}||�s�|j|�q�WWd	QRX|r�td
j|���d	S)a	
    Check that all submodules listed higher up in this file can be imported

    Note that if a PRIVATE_BUT_PRESENT_MODULES entry goes missing, it may
    simply need to be removed from the list (deprecation may or may not be
    needed - apply common sense).
    cSs,ytj|�Wnttfk
r&dSXdS)NFT)r�r��ImportError�AttributeError)r	r
r
r�check_importable�s
z-test_api_importable.<locals>.check_importablez5Modules in the public API that cannot be imported: {}z1Modules in the public API that were not found: {}T)�record�always)�categoryNzPModules that are not really public but looked public and can not be imported: {})
r�r�rr�r��evalr��warnings�catch_warnings�filterwarnings�DeprecationWarning�
ImportWarningr�)r�Zmodule_namesr	�wr
r
r�test_api_importable�s2


r�)N)-r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNr+rOrPrQrRrSr)rTrUrVrWrXrYrZr[r\r]r^r_r`rra)qrbrcrdr0rerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�)r r"r�r�r�r�r�rZpytestr.r�rr�markZparametrizer%r(r*r,Zskipifr4r�r�r�r�r�r�r�r�r�r
r
r
r�<module>s�


,4