summaryrefslogtreecommitdiff
path: root/numpy/testing
Commit message (Collapse)AuthorAgeFilesLines
...
| * ENH: Improve typing with the help of `ParamSpec`Bas van Beek2022-01-241-15/+17
| |
* | Merge pull request #20831 from bwoodsend/numpy-testing-depends-on-distutilsRalf Gommers2022-01-201-2/+2
|\ \ | |/ |/| BUG: Avoid importing numpy.distutils on import numpy.testing (#20769)
| * BUG: Avoid importing numpy.distutils on import numpy.testing (#20769)bwoodsend2022-01-161-2/+2
| | | | | | | | | | Move the offending imports into the functions that use them so that numpy.distutils is only loaded if those functions are required.
* | MAINT, DOC: discard repeated wordsDimitri Papadopoulos2022-01-131-1/+1
| |
* | MAINT, DOC: fix new typos detected by codespellDimitri Papadopoulos2022-01-121-1/+1
|/
* STY: Use subscriptable `collections.abc` types over the generic aliases in …Bas van Beek2021-12-231-4/+2
|
* STY: Use subscriptable `builtins` types over the generic aliases in `typing`Bas van Beek2021-12-232-32/+25
|
* MAINT: Use intp output param viewable casts/methods (#20176)Sebastian Berg2021-12-201-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the cast-is-view flag with a more generic intp output. Such an output could (theoretically) be nonzero, indicating e.g. the offset of a complex number into a real one. (We do not use this yet, though!) The only "tricky" part is that the MinCastSafety helper used to deal with the view-offset as well, and now we have to deal with it explicitly when e.g. multiple fields have to be checked. Bumps the experimental-dtype-api number, since the signatures changed. * MAINT,DOC: Cleanups and clarfications based on Marten's comments Co-Authored-By: Marten van Kerkwijk <mhvk@astro.utoronto.ca> * MAINT: Rename `PyArray_GetCastSafety` to `PyArray_GetCastInfo` Better captures the fact that it also returns the view-offset information now. * MAINT: Fix structured cast-is-view logic * MAINT: Address review comments by Marten Co-authored-by: Marten van Kerkwijk <mhvk@astro.utoronto.ca>
* move get_glibc_version to np.testing; skip 2 more tests for old glibcH. Vetinari2021-12-101-0/+13
|
* ENH: provide a convenience function to replace npy_load_module (#20395)Matti Picus2021-11-191-2/+2
| | | | | | | `load_module` is deprecated since python 3.4 and will be removed in python 3.12. Use `exec_module` instead. Provide a convenience function in `distutils.misc_utils` instead of `npy_load_module` from `compat.py3k`.
* MAINT: Add missing annotations for `IS_PYSTON`Bas van Beek2021-11-051-0/+1
|
* MAINT: Add `IS_PYSTON` to `np.testing.__all__`Bas van Beek2021-11-052-3/+2
|
* BUG: fix test c-extension compilation inside a venvmattip2021-10-281-1/+1
|
* ENH: Configurable allocator (#17582)Matti Picus2021-10-252-1/+252
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes gh-17467. Adds a public struct to hold memory manipulation routines PyDataMem_Handler and two new API functions PyDataMem_SetHandler to replace the current routines with the new ones, and PyDataMem_GetHandlerName to get the string name of the current routines (either globally or for a specific ndarray object). This also changes the size of the ndarray object to hold the PyDataMem_Handler active when it was created so subsequent actions on its data memory will remain consistent. Tests and documentation are included. Along the way, I found some places in the code where the current policy is inconsistent (all data memory handling should have gone through npy_*_cache not PyDataMem_*) so even if this is rejected it might improve the cache handling. The PyDataMem_Handler has fields to override memcpy, these are currently not implemented: memcpy in the code base is untouched. I think this PR is invasive enough as-is, if desired memcpy can be handled in a follow-up PR. * ENH: add and use global configurable memory routines * ENH: add tests and a way to compile c-extensions from tests * fix allocation/free exposed by tests * DOC: document the new APIs (and some old ones too) * BUG: return void from FREE, also some cleanup * MAINT: changes from review * fixes from linter * setting ndarray->descr on 0d or scalars mess with FREE * make scalar allocation more consistent wrt np_alloc_cache * change formatting for sphinx * remove memcpy variants * update to match NEP 49 * ENH: add a python-level get_handler_name * ENH: add core.multiarray.get_handler_name * Allow closure-like definition of the data mem routines * Fix incompatible pointer warnings * Note PyDataMemAllocator and PyMemAllocatorEx differentiation Co-authored-by: Matti Picus <matti.picus@gmail.com> * Redefine default allocator handling * Always allocate new arrays using the current_handler * Search for the mem_handler name of the data owner * Sub-comparisons don't need a local mem_handler * Make the default_handler a valid PyDataMem_Handler * Fix PyDataMem_SetHandler description (NEP discussion) * Pass the allocators by reference * Implement allocator context-locality * Fix documentation, make PyDataMem_GetHandler return const * remove import of setuptools==49.1.3, doesn't work on python3.10 * Fix refcount leaks * fix function signatures in test * Return early on PyDataMem_GetHandler error (VOID_compare) * Add context/thread-locality tests, allow testing custom policies * ENH: add and use global configurable memory routines * ENH: add tests and a way to compile c-extensions from tests * fix allocation/free exposed by tests * DOC: document the new APIs (and some old ones too) * BUG: return void from FREE, also some cleanup * MAINT: changes from review * fixes from linter * setting ndarray->descr on 0d or scalars mess with FREE * make scalar allocation more consistent wrt np_alloc_cache * change formatting for sphinx * remove memcpy variants * update to match NEP 49 * ENH: add a python-level get_handler_name * ENH: add core.multiarray.get_handler_name * Allow closure-like definition of the data mem routines * Fix incompatible pointer warnings * Note PyDataMemAllocator and PyMemAllocatorEx differentiation Co-authored-by: Matti Picus <matti.picus@gmail.com> * Redefine default allocator handling * Always allocate new arrays using the current_handler * Search for the mem_handler name of the data owner * Sub-comparisons don't need a local mem_handler * Make the default_handler a valid PyDataMem_Handler * Fix PyDataMem_SetHandler description (NEP discussion) * Pass the allocators by reference * remove import of setuptools==49.1.3, doesn't work on python3.10 * fix function signatures in test * try to fix cygwin extension building * YAPF mem_policy test * Less empty lines, more comments (tests) * Apply suggestions from code review (set an exception and) Co-authored-by: Matti Picus <matti.picus@gmail.com> * skip test on cygwin * update API hash for changed signature * TST: add gc.collect to make sure cycles are broken * Implement thread-locality for PyPy Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> * Update numpy/core/tests/test_mem_policy.py Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> * fixes from review * update circleci config * fix test * make the connection between OWNDATA and having a allocator handle more explicit * improve docstring, fix flake8 for tests * update PyDataMem_GetHandler() from review * Implement allocator lifetime management * update NEP and add best-effort handling of error in PyDataMem_UserFREE * ENH: fix and test for blindly taking ownership of data * Update doc/neps/nep-0049.rst Co-authored-by: Elias Koromilas <elias.koromilas@gmail.com>
* add another call to gc.collect in break_cyclesmattip2021-10-031-2/+2
|
* STY: Use the PEP 457 positional-only syntax in the stub filesBas van Beek2021-08-311-9/+14
|
* MAINT: Drop .pyi code-paths specific to Python 3.7Bas van Beek2021-08-301-5/+3
|
* ENH: Add `__path__` annotations to all sub-packagesBas van Beek2021-07-251-0/+1
|
* ENH: Add annotations for `<module>.test` objectsBas van Beek2021-07-251-0/+3
|
* Fixed linter errorsslepton2021-07-071-1/+2
|
* TST: Pyston has no recursion limit and the refcount of "immortal" objects is ↵slepton2021-07-071-1/+1
|\ | | | | | | set to ~infinity
* | TST: Pyston has no recursion limit and the refcount of "immortal" objects is ↵slepton2021-07-071-0/+1
|/ | | | set to ~infinity
* For Pyston the refcount of "immortal" objects is set to ~infinityslepton2021-07-071-1/+2
|
* ENH: Add dtype support to `np.testing`Bas van Beek2021-06-061-17/+52
|
* ENH: Add annotations for `np.testing`Bas van Beek2021-06-062-80/+337
|
* MAINT: Remove two private functions from `__all__`Bas van Beek2021-06-064-6/+4
|
* BLD: Add support for *.pyi data-files to `np.testing._private`Bas van Beek2021-06-061-0/+1
|
* MAINT: Move the `np.testing` annotations to `np.testing._private.utils`Bas van Beek2021-06-062-102/+148
|
* MAINT: Add placeholder annotations for two missing `np.testing` objectsBas van Beek2021-05-051-0/+6
| | | | Adds placeholders for two `np.testing` objects previously missed in https://github.com/numpy/numpy/pull/18842.
* ENH: Add improved placeholder annotations for `np.testing`Bas van Beek2021-04-231-43/+104
|
* DOC: Use: from numpy.testing import ...Tim Hoffmann2021-04-131-5/+5
| | | | | | | | | | | | instead of `import numpy.testing as npt`. - all of NumPy's own tests themselves use the from-import variant - There's `import numpy.typing as npt` around in some places so we should not abbreviate another module import with `npt`. Optional further enhancement: If this is a convention we also want users to adopt, this should be mentioned in the module docstring of `numpy.testing`.
* Merge pull request #18579 from mwtoews/refactor-dictRalf Gommers2021-03-211-13/+1
|\ | | | | MAINT: OrderedDict is no longer necessary from Python 3.7
| * MAINT: OrderedDict is no longer necessary from Python 3.7Mike Taves2021-03-081-13/+1
| |
* | Merge pull request #18642 from seberg/splitup-faster-argparsing-optimize-asarrayMatti Picus2021-03-211-11/+13
|\ \ | | | | | | ENH: Use new argument parsing for array creation functions
| * | ENH: Use new argument parsing for array creation functionsSebastian Berg2021-03-181-11/+13
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The array creation functions have the most to gain: 1. np.asarray is 4 times faster and commonly used. 2. Other functions are wrapped using __array_function__ in Python making it more difficult This commit (unfortunatly) has to do a few things: * Modify __array_function__ C-side dispatching to accomodate the fastcall argument convention. * Move asarray, etc. to C after removing all "fast paths" from np.array (simplifying the code) * Fixup imports, since asarray was imported directly in a few places * Replace some places where `np.array` was probably used for speed instead of np.asarray or similar. (or by accident in 1 or 2 places)
* | MAINT: use super() as described by PEP 3135Mike Taves2021-03-192-7/+7
|/
* BUG: Allow unmodified use of isclose, allclose, etc. with timedeltaSebastian Berg2021-02-041-0/+5
| | | | | | | | | | | | | | Disallowing timedelta64+float promotion (to timedelta64) in all cases (previously it was assymetric and "half allowed") meant that isclose, allclose, np.ma.allclose, and assert_arrays_almost_equal (which uses isclose), would stop work for timedelta64. Hardcoding that timedelta64 is passed on unmodified retains the old behaviour. It may make sense to deprecate or change this behaviour in the future, but for the 1.20 release, the behaviour should be as much unmodified as possible. Closes gh-18286
* MAINT: Add missing `__all__` annotationsBas van Beek2021-02-011-1/+3
|
* DOC: Avoid using "set of" when talking about an ordered list.Antony Lee2020-12-291-1/+1
| | | | | | | | | | | | ... or when the input isn't/cannot be a set. I left a few usages, e.g. in random sampling, where "set" is reasonable as informal description of an array as the order doesn't matter; however, for e.g. np.gradient the order of the returned list is clearly important, so "set" is wrong. Also some other minor doc edits noticed during the grepping: using `shape` instead of `form` in `cov` is consistent with most other places; the wording in `Polynomial.trim` now matches other methods on the same class.
* Merge pull request #18051 from rpolley/deprecate-np-testing-dec-2Matti Picus2020-12-292-210/+47
|\ | | | | DEP: deprecate np.testing.dec
| * TST: move np.testing.dec tests to test_deprecations.pyRyan Polley2020-12-201-210/+0
| |
| * DEC: update deprecation version to 1.21 and add date commentsRyan Polley2020-12-201-12/+18
| |
| * DEC: deprecate the decorators in np.testing.decRyan Polley2020-12-201-0/+41
| | | | | | | | | | | | Since the decorators in np.testing.dec are intended for nose test framework support, deprecate them by updating the docstring and adding a warning when they are used on functions
* | DOC: Fix a couple of reference to verbatim and vice versaMatthias Bussonnier2020-12-181-1/+1
|/ | | | | | | | | | | | | | | | This update a coupe of references (single backticks) that actually are not to verbatim/code (double backticks); and a couple of verbatim to reference when they do actually exists and can be resolved in context. I probably missed other; and stayed simple but spoted a few other inconsistencies that I did not fix: - some ``...`` could actually be :math:`...` but not always clear if it would be better. - some intervals are [``...``], other are ``[...]`` I guess they could be discussed individually; it was mostly the failing references that bothered me.
* Fix AttributeError: 'bool' object has no attribute 'ndim'Christoph Gohlke2020-12-031-1/+1
|
* MAINT: Rewrite can-cast logic in terms of NEP 42Sebastian Berg2020-11-241-1/+109
|
* BUG: Fixed an issue where `.pyi` weren't picked up by numpy sub-packagesBas van Beek2020-11-031-0/+1
|
* minor typographic changeJakob2020-10-241-1/+1
|
* more fixesJakob2020-10-231-4/+4
|
* fix quotation marksJakob2020-10-231-1/+1
|