summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
Commit message (Collapse)AuthorAgeFilesLines
* TST: avoid refcount semantics, speed up testsMatti Picus2020-11-111-85/+56
|
* ENH: Implement sliding window (gh-17394)Klaus Zimmermann2020-11-051-2/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * implement sliding_window_view #7753 Test cases are shown in the issue page. * Add Example Cases * Add step_size and N-dim support * Add shape and step_size check. Remove warning. * Remove shape default Add step_size default's description. * Give proper parameter name 'step' * fix a parameter description mistake * implement test function for sliding_window_view() * implement test function for sliding_window_view() * Fix according to @eric-wieser comments * Change arange to ogrid in Examples * remove np.squeeze on return line * Clarify document to avoid parameter confusion. * add `writable` and more explanation in docs * resolve a write conflit * fixes according to @seberg review * resolve write hazard * remove outdated docs. * change referring according to @mattip. change 'writeable' to 'readonly' as @seberg suggest. remove 'step' as @eric-wieser request * fix test minor error * DOC: Grammar fixes * STY: Add missing line break required by PEP8 * + Change readonly parameter to writeable. + Update writeable description. + Fix a few parameter checks. + Other minor improvements. * Move to new api as proposed by @eric-wieser - Change api to follow suggestion by Eric Wieser in https://github.com/numpy/numpy/pull/10771#issuecomment-524715356 - Update docstring - Add more tests * Improve documentation * Add sliding_window_view to documentation index * Apply suggestions from code review Co-authored-by: Eric Wieser <wieser.eric@gmail.com> * Fix window shape check * Add `sliding_window_view` to __all__ * Add tests for error cases * Add array_function dispatching * Change dispatcher argument defaults to None * Simplify array function dispatching * Added "np." prefix to doctests * Split tests * Improved docstring * Add release note * Fix docstring formatting * Fix doctest * Remove namespacing in documentation indexing * Improve docstring * Improved docstring * Simplified docstring * Improve docstring to make pseudo code stand out * Improve docstring * Add simple application example * Correct release note * Improve link with as_strides * Add note about performance * Tidy up main doc string * Make language on performance warning stronger * Bugfix: pass subok and writeable to as_strided * Add writeable test * Add subok test * Change subok test to use custom array subclass instead of unsupported MaskedArray * Add version added information Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Fanjin <fjzeng@ucsd.edu> Co-authored-by: Fanjin Zeng <Fnjn@users.noreply.github.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: fanjin <fjzeng@outlook.com> Closes gh-7753
* BUG: Respect dtype of all-zero argument to poly1dCameron Blocker2020-10-171-0/+14
| | | | | Fixes gh-16354. Previously np.poly1d(z).coeffs.dtype would always be np.float64 for zero array z, regardless of z's dtype.
* ENH: add function to get broadcast shape from a given set of shapes. (#17535)madhulikajc2020-10-171-2/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ENH: add function to get broadcast shape from a given set of shapes. Add new function numpy.broadcast_shape which takes tuples for the shapes to be broadcast against each other. Return the broadcasted shape as a tuple. See #17217 * Perform array allocations of size 0 for provided shape tuples Co-authored-by: Eric Wieser <wieser.eric@gmail.com> * Test for int as input shape Also update docstring to include both ints and tuples of ints as input * Remove unnecessary array_function_dispatch * Add missing set_module * Add release notes. Add versionadded to docstring. Also fix up docstring details. * follow convention for trailing comma Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> * Change name to broadcast_shapes. Also add test case, and type hint. * follow convention Co-authored-by: Eric Wieser <wieser.eric@gmail.com> * Update docstring Co-authored-by: Eric Wieser <wieser.eric@gmail.com> * Add reference to numpy docs on broadcasting to docstring Also move versionadded * Fix spelling Co-authored-by: Warren Weckesser <warren.weckesser@gmail.com> * Add broadcast_shapes to reference docs and add See Also sections Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> Co-authored-by: Warren Weckesser <warren.weckesser@gmail.com>
* MAINT: Do not emit empty Methods heading in np.info (#17498)Steve Joachim2020-10-101-0/+19
| | | | | Fixes the incompatible type comparison found in #17490. This also corrects the logic to not print the heading when only private/magic methods are present.
* ENH: add dtype option to cov and corrcoef (#17456)Lisa Schwetlick2020-10-091-0/+12
| | | | | | | Adds a keyword-only dtype parameter to correlate and coerrcoef to allow user to specify the dtype of the output. Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* BUG: Fixes incorrect error message in numpy.ediff1d (#17457)stuartarchibald2020-10-051-7/+11
| | | | | | Fixes the error message reported by ediff1d in the case of an invalid to_begin and updates tests to assert validity. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Merge pull request #17285 from seberg/tune-down-financial-warningCharles Harris2020-09-121-1/+1
|\ | | | | DEP: Change the financial name access warning to DeprecationWarning
| * DEP: Change the financial name access warning to DeprecationWarningSebastian Berg2020-09-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Most end-users will probably not care about the warning in any case, since they will not just import the function but also use it. We can't just remove it, due to gh-17143: Astropy currently pulls in these functions (but doesn't use them), so that plain removal would lead to an unusable astropy if a new NumPy is installed. Even more annoying, due to a (faulty?) astropy pytest plugin, this affects all pytest runs (which do not use `PYTEST_DISABLE_PLUGIN_AUTOLOAD`). Changing it to a DeprecationWarning seems to remove the issue from pytest runs, this may make the warning less visible in rare cases where it should be seen, but hopefully it will still be visible enough.
* | ENH: Allow genfromtxt to unpack structured arrays (#16650)Andrew Eckart2020-09-111-1/+46
|/ | | | | | | | | | | | | * ENH: Allow genfromtxt to unpack structured arrays genfromtxt failed to transpose output when unpack=True and `dtype` was structured (or None). This patch resolves the issue by returning a list of arrays, as in `loadtxt`. Co-authored-by: Matti Picus <matti.picus@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Merge pull request #17193 from eric-wieser/clean-compatSebastian Berg2020-09-031-1/+1
|\ | | | | MAINT: Remove some callers of functions in numpy.compat
| * MAINT: Remove users of `numpy.compat.bytes`Eric Wieser2020-08-311-1/+1
| | | | | | | | Some more Python 2 cleanup.
* | ENH: Make the window functions exactly symmetricEric Wieser2020-08-311-4/+4
|/ | | | | | This relies on the fact that `cos` is exactly symmetric around zero, but not around the floating-point approximation of `pi`. Closes gh-17169.
* BUG: revert trim_zeros changes from gh-16911mattip2020-08-271-0/+4
|
* MAINT: lib: Change handling of the expired financial functions.Warren Weckesser2020-08-221-6/+7
| | | | | | | | | | | | | | | | | | In a previous commit, the expired financial functions were removed from NumPy, and code was added to __init__.py using the module __getattr__ to raise a customized AttributeError on any attempt to reference the expired names in the numpy namespace. That change broke released versions astropy, which has code that imports the financial functions. astropy never calls the functions, so they never saw the deprecation warnings that have been in place since numpy 1.18. This means that attempting to use a released version of astropy with numpy 1.20 will cause astropy to crash with the custom AttributeError. In this commit, instead of raising an exception when one of the expired names is referenced, a warning is generated. If the function is *called*, an exception is raised.
* Merge pull request #17058 from BvB93/trim_zeros2Matti Picus2020-08-191-1/+17
|\ | | | | MAINT: Revert boolean casting back to elementwise comparisons in `trim_zeros`
| * TST: Added / updated object array-related testsBas van Beek2020-08-131-1/+18
| |
| * ENH: Use elementwise comparisons with 0 rather than boolean castingBas van Beek2020-08-111-2/+1
| |
* | BUG: fix typo in polydiv that prevented promotion to poly1d (#17053)jakobjakobson132020-08-171-0/+9
| | | | | | Fix bug caused by typo and added tests
* | DEP: lib: Remove the deprecated financial functions. (#17067)Warren Weckesser2020-08-122-380/+12
| | | | | | | | | | | | | | | | | | As explained in NEP 32, the financial functions are to be removed from version 1.20. They are now replaced with module level `__getattr__` to give a useful error message for those surprised by the `AttributeError`. This only works for Python 3.7+, but it is expected that by the 1.20 release Python 3.6 will not be supported.
* | API, BUG: Raise error on complex input to i0 (#17062)peterbell102020-08-121-2/+7
|/ | | | * BUG, API: Raise error on complex input to np.i0
* ENH: Speed up trim_zeros (#16911)Bas van Beek2020-08-041-12/+34
| | | | | | | | | | | | | * Added a benchmark for `trim_zeros()` * Improve the performance of `np.trim_zeros()` * Increase the variety of the tests Fall back to the old `np.trim_zeros()` implementation if an exception is encountered. Emit a `DeprecationWarning` in such case. * DEP,REL: Added a deprecation release note
* TST: fix tests for windows + PyPymattip2020-07-302-17/+33
|
* Merge pull request #16815 from cjblocker/mgrid-floatMatti Picus2020-07-251-0/+27
|\ | | | | BUG: fix mgrid output for lower precision float inputs
| * MAINT: reference issue in comments for added index_tricks testsCameron Blocker2020-07-131-0/+2
| |
| * TST: update mgrid test from code reviewCameron Blocker2020-07-131-4/+6
| | | | | | Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
| * TST: fixed dtype check error from code reviewCameron Blocker2020-07-121-2/+2
| |
| * BUG: fix mgrid output for lower precision float inputsCameron Blocker2020-07-121-0/+23
| | | | | | | | | | | | Floats besides float64 were being coerced to integers and complex step sizes for the index trick classes would fail for complex64 input. Fixes #16466
* | Revert "Merge pull request #16248 from alexrockhill/edge"mattip2020-07-231-7/+0
| |
* | simplifiedAlex2020-07-221-0/+3
| |
* | changed from large number error to different solutionAlex2020-07-221-1/+1
| |
* | edge first tryAlex2020-07-221-0/+4
| | | | | | | | | | | | ENH: added edge keyword argument to digitize added test
* | TST, BUG: Re-raise MemoryError exception in test_large_zip's process (gh-16890)Antonio Larrosa2020-07-181-8/+22
|/ | | | | | | | | | | | Since #15893, test_large_zip's actual test is run in a child process, so when this test raises a MemoryError exception, the exception is lost and the @requires_memory decorator can't catch it to return an xfail. This commit uses a boolean variable in shared memory to flag if the exception was raised, and in that case, re-raise it in the parent process. Fixes #16889
* MAINT: Fixup quantile tests to not use `np.float`Sebastian Berg2020-06-271-8/+9
| | | | | | This is deprecated usage, also small code style fixups since I was looking at it anyway. YMMV, but I think its a bit/nicer more compact now.
* Merge pull request #16273 from CloseChoice/BUG-order_percentile-monotonicallySebastian Berg2020-06-271-0/+71
|\ | | | | BUG: Order percentile monotonically
| * limit test_quantile_monotonicTobias Pitters2020-06-121-3/+8
| |
| * Update numpy/lib/tests/test_function_base.pyTobias Pitters2020-06-121-4/+4
| | | | | | Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
| * check for `greater-equal` in lerp monotony testTobias Pitters2020-06-101-1/+1
| |
| * check for `greater-equal` in lerp monotony testTobias Pitters2020-06-101-1/+1
| |
| * make lerp be able to handle 0d casesTobias Pitters2020-06-101-0/+6
| |
| * refactor quantile testsTobias Pitters2020-05-271-4/+2
| |
| * limit range of lerp inputsTobias Pitters2020-05-271-10/+10
| |
| * Update numpy/lib/tests/test_function_base.pyTobias Pitters2020-05-271-2/+8
| | | | | | Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
| * fix lerp function and corresponding testsTobias Pitters2020-05-271-4/+8
| |
| * Update numpy/lib/tests/test_function_base.pyTobias Pitters2020-05-271-0/+1
| | | | | | Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
| * use symmetric lerp functionTobias Pitters2020-05-271-1/+1
| |
| * fix symmetry testTobias Pitters2020-05-271-1/+1
| |
| * remove pdb; add hypothesis tests for monotony, boundedness and symmetry of lerpTobias Pitters2020-05-271-0/+31
| |
| * add hypothesis test, fix bug of non-monotonic ordering of quantile functionCloseChoice2020-05-271-1/+14
| |
| * BUG: np.quantile ordering not monotonicTobias Pitters2020-05-271-0/+7
| |