summaryrefslogtreecommitdiff
path: root/numpy/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* MAINT: Move pickle import to numpy.compatCharles Harris2019-02-211-1/+1
| | | | | | | The pickle module was being imported from numpy.core.numeric. It was defined there in order to use pickle5 when available in Python3 and cpickle in Python2. The numpy.compat module seems a better place for that.
* ENH: Add np.ctypeslib.as_ctypes_type(dtype), improve `np.ctypeslib.as_ctypes`Eric Wieser2019-01-131-0/+92
| | | | | | | This also improves `np.ctypeslib.as_ctypes` to support more types of array: * non-native endianness * structured arrays with non-overlapping fields * booleans
* BUG,TST: Remove the misguided `run_command` that wraps subprocess in a ↵Eric Wieser2018-12-181-71/+16
| | | | | | broken way Also switches to using a parametrized test, for better error messages
* DEV: add test for 'python -mnumpy.f2py'mattip2018-12-181-0/+5
|
* BUG: fix segfault in ctypeslib with obj being collectedAnthony Sottile2018-12-161-0/+13
| | | | | - https://bugs.python.org/issue35507 - https://stackoverflow.com/q/53757856/812183
* MAINT: Review F401,F841,F842 flake8 errors (unused variables and imports) ↵Roman Yurchak2018-12-061-1/+1
| | | | | | | | | | | | (#12448) * Review F401,F841,F842 flake8 errors (unused variables, imports) * Review comments * More tests in test_installed_npymath_ini * Review comments
* BUG: test, fix NPY_VISIBILITY_HIDDEN on gcc, which becomes NPY_NO_EXPORTmattip2018-11-221-1/+13
|
* BUG/ENH: Fix use of ndpointer in return valuesEric Wieser2018-11-211-5/+70
| | | | | | | | | | | This: * fixes a regression in 1.15, where it became impossible to set the return value of a cdll function to an ndpointer. * removes ndpointer.__array_interface__, which was being ignored anyway in favor of the PEP3118 buffer protocol * adds `ndpointer.contents` to recover the lost functionality, while staying in line with the ctypes behavior * removes another instance of `descr`, which enables overlapping fields to be returned from C functions (such as unions). * Fixes a long-term bug where using ndpointer as a return type without specifying both type and dtype would produce an object array containing a single `ndpointer`. Now the ndpointer is returned directly. This relates to gh-12421, and likely fixes toinsson/pyrealsense#82
* BUG: Fix inconsistent cache keying in ndpointerEric Wieser2018-11-191-3/+8
| | | | | | | | Fixes an alarming bug introduced in gh-7311 (1.12) where the following is true np.ctypeslib.ndpointer(ndim=2) is np.ctypeslib.ndpointer(shape=2) Rework of gh-11536
* MAINT: fix tests on Python 2Stephan Hoyer2018-11-141-0/+6
|
* MAINT: separate builtins and undocumented functionsStephan Hoyer2018-11-131-8/+12
|
* DOC: add a comment explaining why we use normal assertStephan Hoyer2018-11-131-0/+2
|
* ENH: set correct __module__ for objects in numpy's public APIStephan Hoyer2018-11-131-0/+65
| | | | | | | | | | | | | Fixes GH-12271 Tests verify that everything in ``dir(numpy)`` either has ``__module__`` set to ``'numpy'``, or appears in an explicit whitelist of undocumented functions and exported bulitins. These should eventually be documented or removed. I also identified a handful of functions for which I had accidentally not setup dispatch for with ``__array_function__`` before, because they were listed under "ndarray methods" in ``_add_newdocs.py``. I guess that should be a lesson in trusting code comments :).
* MAINT, TST import pickle from numpy.core.numericPierre Glaser2018-10-101-3/+5
| | | | | | | | All imports of pickle from numpy modules are now done this way: >>> from numpy.core.numeric import pickle Also, some loops on protocol numbers are added over pickle tests that were not caught from #12090
* removing warningsEric Schles2018-09-251-1/+0
|
* updating test file to ignore the failureEric Schles2018-09-251-10/+4
|
* updating f2py to ensure that at least f2py base exists, and doesn't error ↵Eric Schles2018-09-251-3/+11
| | | | out if multiple do not
* Merge pull request #10915 from mattip/implement-nep-0015Charles Harris2018-08-311-4/+4
|\ | | | | ENH: implement nep 0015: merge multiarray and umath
| * MAINT: merge umath, multiarray into _multiarray, add python wrappersmattip2018-08-211-4/+4
| |
* | ENH: Use entry_points to install the f2py scripts.Charles Harris2018-08-231-20/+25
|/ | | | | | | | | | | | | | | | | | | | | This adds entry_points for the f2py scripts. The installed scripts differ between Windows and other environments. * On Windows, the only script installed is 'f2py'. This works well in that environment because each Python version is installed in its own directory, making it easy to keep the differing script versions separate. * Otherwise, three scripts are installed, 'f2py', 'f2py' + 'minor', and 'f2py' + 'major.minor'. For instance, if Numpy is installed by Python 2.7, then the installed scripts will be named 'f2py', 'f2py2', and 'f2py2.7'. That naming scheme is used for back compatibility, and also so that more than one Python version can be dealt with in a way common to many Linux distros. Note that 'f2py' will always point to the latest install and 'f2py(2|3)' to the latest Python (2|3) install The script tests have been modified to check for the new environment and the code previously used to install the scripts has been removed.
* MAINT: Improve memory usage in PEP3118 format parsingEric Wieser2018-07-231-0/+20
| | | | | | | Previously a local `Stream` class would be defined every time a format needed parsing. Classes in cpython create reference cycles, which create load on the GC. This may or may not resolve gh-6511
* Merge pull request #10970 from eric-wieser/cut-down-ctypeslibCharles Harris2018-06-071-10/+67
|\ | | | | WIP: Remove fragile use of __array_interface__ in ctypeslib.as_array
| * BUG: Remove fragile use of __array_interface__ in ctypeslib.as_arrayEric Wieser2018-05-261-5/+43
| | | | | | | | | | | | | | | | | | | | Everything behaves a lot better if we let the array constructor handle it, which will use the ctypes PEP3118 support. Bugs this fixes: * Stale state being attached to pointer objects (fixes gh-2671, closes gh-6214) * Weird failure modes on structured arrays (fixes-10978) * A regression in gh-10882 (fixes gh-10968)
| * MAINT: Pull repeated decorators up to their containing classEric Wieser2018-04-241-12/+9
| |
| * MAINT: Use assert_equalEric Wieser2018-04-241-4/+4
| |
| * TST: Add tests for numpy.ctypeslib.as_arraytynn2018-04-241-2/+24
| |
* | TST: Ignore PendingDeprecationWarning in matrixlib tests.Marten van Kerkwijk2018-05-291-0/+8
|/
* MAINT: Remove all uses of run_module_suite.Charles Harris2018-04-065-25/+4
| | | | | That function is nose specific and has not worked since `__init__` files were added to the tests directories.
* TST: Switch to using pytest markersCharles Harris2018-04-043-18/+19
| | | | | | | | | | | Use standard pytest markers everywhere in the numpy tests. At this point there should be no nose dependency. However, nose is required to test the legacy decorators if so desired. At this point, numpy test cannot be run in the way with runtests, rather installed numpy can be tested with `pytest --pyargs numpy` as long as that is not run from the repo. Run it from the tools directory or some such.
* ENH: Add a repr to np._NoValueEric Wieser2018-02-031-1/+7
| | | | | | This change _NoValue from a class to an instance, which is more inline with the builtin None. Fixes gh-8991, closes gh-9592
* ENH: Add `order=` keyword to `np.eye()` (#9996)Danny Hermes2017-11-121-4/+13
| | | Fixes #9995
* TST, MAINT: Add `__init__.py` files to tests directories.Charles Harris2017-08-061-0/+0
| | | | | | | | This allows pytest to run with duplicate test file names. Note that `python <path-to-test-file>` no longer works with this change, nor will a simple `pytest numpy`, because numpy is imported from the numpy repository. However, `python runtests.py` and `>>> numpy.test()` are still available.
* MAINT/DOC: Use builtin when np.{x} is builtins.{x}.Eric Wieser2017-08-051-1/+1
| | | | | | | This is the case for x in {int, bool, str, float, complex, object}. Using the np.{x} version is deceptive as it suggests that there is a difference. This change doesn't affect any external behaviour. The `long` type is missing in python 3, so np.long is still useful
* TST: Remove unittest dependencies in numpy/tests.Charles Harris2017-07-241-23/+23
|
* MAINT: Rearrange files in numpy/testing module.Charles Harris2017-07-042-7/+4
| | | | | | | | | | | | | | | | | The aim here is to separate out the nose dependent files prior to adding pytest support. This could be done by adding new files to the general numpy/testing directory, but I felt that it was to have the relevant files separated out as it makes it easier to completely remove nose dependencies when needed. Many places were accessing submodules in numpy/testing directly, and in some cases incorrectly. That presented a backwards compatibility problem. The solution adapted here is to have "dummy" files whose contents will depend on whether of not pytest is active. That way the module looks the same as before from the outside. In the case of numpy itself, direct accesses have been fixed. Having proper `__all__` lists in the submodules helped in that.
* BUG: KeyboardInterrupt is swallowed all over the placeEric Wieser2017-06-031-1/+1
| | | | Bare except is very rarely the right thing
* ENH: Spelling fixesVille Skyttä2017-05-091-2/+2
|
* MAINT: Remove asbytes where a b prefix would sufficeEric Wieser2017-03-251-3/+3
| | | | | | | | Since we only need to support python 2, we can remove any case where we just pass a single string literal and use the b prefix instead. What we can't do is transform asbytes("tests %d" % num), because %-formatting fails on bytes in python 3.x < 3.5.
* TST: Add tests for stacklevel in warnings and "ignore" filters.Sebastian Berg2016-09-021-0/+86
| | | | | Enforces that stacklevel is used in warnings.warn and "ignore" is not used in filterwarnings or simplefilter for most of numpy.
* BUG: Make sure numpy globals keep identity after reload.Charles Harris2016-08-161-3/+11
| | | | | | | | | | | | Reloading currently causes problems because global classes defined in numpy/__init__.py change their identity (a is b) after reload. The solution taken here is to move those classes to a new non-reloadable module numpy/_globals and import them into numpy from there. Classes moved are ModuleDeprecationWarning, VisibleDeprecationWarning, and _NoValue. Closes #7844.
* BUG: Raise RuntimeError when reloading numpy is attempted.Charles Harris2016-07-201-0/+26
| | | | | | | | | | There seems to be little use in reloading numpy as any changed modules that are imported into numpy would need to be reloaded first in order to see any changes. Furthermore, reloading causes problems as global classes defined in numpy/__init__.py change their identity. Hence we raise a RuntimeError when an attempt to reload numpy is made. Closes #7844.
* TST: Fix test_ctypeslib and test_indexing when running on debug interpreterTadeu Manoel2016-04-201-1/+8
|
* [PATCH] Make _pointer_type_cache functionalMeet Udeshi2016-02-231-0/+5
| | | | | | | Fix #2303 Cache queries wont miss because the whole tuple is cached as key and not just dtype Adapted from patch submitted by Colin Hogben
* MAINT: Use `is None` or `is not None` instead of `== None` or `!= None`.Dongjoon Hyun2016-02-151-1/+1
|
* TST: Fixed f2py test for Anaconda non-win32gfyoung2016-02-021-8/+3
| | | | | | | | | | | When you run 'python -V' under Anaconda, it returns for example, 'Python 3.4.3 :: Continuum Analytics, Inc.' However, the original parsing of the version in 'test_f2py' assumed there was nothing following the version number, causing a ValueError because you can't assign three variables to four components that you get from splitting on the '.'
* TST: Fixed f2py test for non-versioned python executablesgfyoung2016-01-251-4/+13
| | | | | | | | | | | The 'sys.executable' can come in various names, but the three main ones are "python", "python{major_version}", and "python{major_version.minor_version}". The current version of the f2py test assumes that only the latter two are used. Since "f2py" is generally versioned, using the executable basename "python" will make it impossible to find. This commit fixes that issue by using a sure-fire way of getting the Python version.
* TST: Fixed f2py test for win32 virtualenvgfyoung2016-01-251-1/+7
| | | | | | | | Fixed test_scripts.test_f2py test so that it can pass correctly on win32 virtualenvs, in which the Python executable and the f2py.py file are both in the Scripts directory.
* TST: fix issues with test for correctness of numpy version string.Ralf Gommers2016-01-161-4/+4
| | | | Addresses comments of @pv on gh-6895.
* TST: add test to check for correct version string format.Ralf Gommers2016-01-161-0/+23
| | | | Implements idea suggested in gh-6431.
* BUG: ignore exceptions in numpy/tests/test_scripts.py/test_f2pCharles Harris2015-12-261-4/+5
| | | | | | | | The test was checking whether the f2py script was installed as either of two names, but was only catching OSError, so the second check was skipped if the first failed for another reason. The caused the runtests.py script to fail it does not install the script as f2py but rather with the python version appended.