summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
Commit message (Collapse)AuthorAgeFilesLines
* BUG: ensure np.median does not drop subclass for NaN result.Marten van Kerkwijk2021-09-141-0/+10
| | | | | | | | Currently, np.median is almost completely safe for subclasses, except if the result is NaN. In that case, it assumes the result is a scalar and substitutes a NaN with the right dtype. This PR fixes that, since subclasses like astropy's Quantity generally use array scalars to preserve subclass information such as the unit.
* MAINT: Make parameters match label.Charles Harris2021-09-131-1/+1
|
* TST: Fix a couple of `pytest` id labelsBas van Beek2021-09-131-3/+3
| | | | Co-Authored-By: Charles Harris <charlesr.harris@gmail.com>
* TST: Expand/rewrite the `test_allnans` testsBas van Beek2021-09-111-79/+115
| | | | Parametrize w.r.t. the axis, array dimensionality and dtype
* TST: Expand `TestNanFunctions_NumberTypes` with 0d arraysBas van Beek2021-09-091-12/+17
|
* TST: Make nanfunc test ignore overflow instead of xfailing testSebastian Berg2021-09-071-3/+1
| | | | | | This makes the test more precise, and I ran into having to broaden the xfails otherwise, because right now reduce-likes incorrectly faile to give floating point warnings (and I was fixing that).
* TST: Add more tests for `nanmedian`, `nanquantile` and `nanpercentile`Bas van Beek2021-09-031-0/+17
|
* TST: Expand the old `TestNanFunctions_IntTypes` test with non-integer number ↵Bas van Beek2021-09-031-71/+52
| | | | types
* MAINT: revise OSError aliases (IOError, EnvironmentError)Mike Taves2021-09-021-3/+3
|
* MAINT: refactor "for ... in range(len(" statementsMike Taves2021-09-012-8/+7
|
* Merge pull request #19627 from ankitdwivedi23/ankitd/vectorize-ignore-whitespaceCharles Harris2021-08-161-0/+15
|\ | | | | BUG: Ignore whitespaces while parsing gufunc signatures
| * dummy change to kick off another buildAnkit Dwivedi2021-08-081-1/+1
| |
| * fix lint errorsAnkit Dwivedi2021-08-071-1/+2
| |
| * add tests to check if whitespaces are ignored in gufunc signaturesAnkit Dwivedi2021-08-071-0/+14
| |
* | ENH: Allow `np.fromregex` to accept `os.PathLike` implementationsBas van Beek2021-08-161-2/+4
|/
* Merge pull request #19615 from rossbar/rm-deprecated-npyio-fnsCharles Harris2021-08-061-22/+0
|\ | | | | MAINT: Proposal to expire three deprecated functions in numpy.lib.npyio
| * Rm numpy.lib.npyio.mafromtxt.Ross Barnowski2021-08-051-11/+0
| |
| * Rm numpy.lib.npyio.ndfromtxt.Ross Barnowski2021-08-051-11/+0
| |
* | Merge pull request #19612 from BvB93/testCharles Harris2021-08-061-1/+5
|\ \ | |/ |/| TST: Bump the python 3.10 test version from beta4 to rc1
| * TST: Skip `test_lookfor` in 3.10rc1Bas van Beek2021-08-061-1/+5
| | | | | | | | Broken in rc1 as of bpo-44524
* | PERF: Speed-up common case of loadtxt()ing non-hex floats. (#19598)Antony Lee2021-08-051-0/+22
|/ | | | | | | | | | | | | * PERF: Speed-up common case of loadtxt()ing non-hex floats. `python runtests.py --bench bench_io` reports a ~5-10% perf gain. * TST: Add tests to check fromhex not called unintentionally. Adds regression tests to check that the logic surrounding when the default floatconv applies the fromhex conversion does not change. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Merge pull request #19356 from mhvk/functionbase-vectorize-refactorSebastian Berg2021-07-061-1/+21
|\ | | | | API: Ensure np.vectorize outputs can be subclasses.
| * API: Ensure np.vectorize outputs can be subclasses.Marten van Kerkwijk2021-06-261-1/+21
| | | | | | | | | | | | | | As is, this is true for the ufunc case, but not for the gufunc case, even if the underlying function does produce a subclass. Given the care taken to ensure inputs are kept as subclasses, this is almost certainly an oversight, which is here corrected.
* | BUG: Do not raise deprecation warning for all nans in unique (#19301)Thomas J. Fan2021-06-291-0/+11
|/ | | | | This PR adjusts np.unique for the edge cases where all values are nan. Fixes gh-19300
* ENH: support major version larger than 9 in numpy.lib.NumpyVersionKenichi Maehashi2021-06-101-1/+1
|
* API: Delay string and number promotion deprecation/future warningSebastian Berg2021-06-041-2/+1
| | | | | | | | | | Unfortunately, this seems to cause some pain in pandas at least to circumvent the warning. Delaying may complicate the creation of ufuncs for strings, but otherwise should not be a big problem. We have to make sure that we can reimplement the change quickly though, it is an important change in my opinion.
* TST: Update the `poly1d.__getitem__` and `__eq__` testsBas van Beek2021-05-281-5/+26
|
* TST: Update the `np.nanmedian` tests for all-nan arraysBas van Beek2021-05-221-16/+34
| | | | Test multiple dtypes in the `test_allnans` + a minor refactor
* Merge pull request #16987 from scimax/masterCharles Harris2021-05-191-0/+18
|\ | | | | ENH: Phase unwrapping generalized to arbitrary interval size
| * Add missing whitespaceEric Wieser2020-09-141-0/+1
| |
| * Updated incorrect argument in tests. boundary correction for int and float.Max Kellermeier2020-08-211-5/+6
| | | | | | | | Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
| * Update numpy/lib/tests/test_function_base.pyscimax2020-08-201-1/+1
| | | | | | Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
| * Tests added according to #14877, obsolete comments removed.Max Kellermeier2020-08-021-1/+17
| |
* | BUG: Prevent nan being used in percentile (gh-18831)Kevin Sheppard2021-04-221-0/+22
| | | | | | | | | | Reject NaN as a percentile/quantile value. Previously NaNs could pass the range check `0 <= q <= 1`. closes #18830
* | review commentsDCtheTall2021-04-051-6/+13
| |
* | rm commentDCtheTall2021-03-311-1/+0
| |
* | Add tests np.meshgrid for higher dimensional grids.DCtheTall2021-03-311-0/+15
| |
* | MAINT: use super() as described by PEP 3135Mike Taves2021-03-191-1/+1
| |
* | API: make piecewise subclass safe using use zeros_like.Marten van Kerkwijk2021-02-221-0/+8
| | | | | | | | | | | | Subclass input of piecewise was already respected, so it seems more logical to ensure the output is the same subclass (possibly just an oversight that it was not done before).
* | BUG: Fix unique handling of nan entries. (#18070)Filip Trojan2021-02-121-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * benchmark bench_lib.Unique added * extended test_unique_1d * modify _unique1d * extend test with return_index, return_inverse and return_counts parameters * documentation updated * Update numpy/lib/arraysetops.py Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> * full coverage of nan types Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> * added tests for the datetime like dtypes * nan as vector of length 1 * use aux[-1] as nan, ..versionchanged, release note * for complex arrays all NaN values are considered equivalent Co-authored-by: filip_trojan <Tarantula2018> Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com>
* | numpy/lib/arraysetops.pyAngelGris2021-02-081-0/+33
| |
* | Merge pull request #18116 from seberg/futurewarn-string-promotionMatti Picus2021-01-261-1/+4
|\ \ | | | | | | DEP: Deprecate promotion of numbers and bool to string
| * | DEP: Deprecate promotion of numbers and bool to stringSebastian Berg2021-01-251-1/+4
| | |
* | | fix from reviewmattip2021-01-241-2/+5
| | |
* | | TST: raise memory limit for testmattip2021-01-221-1/+1
|/ /
* | DOC: Doc for deprecate_with_doc (#17852)kumudlakara2020-12-171-1/+10
| | | | | | | | | | | | * Add doc for deprecate_with_doc Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> Co-authored-by: Matti Picus <matti.picus@gmail.com>
* | DEP: Finalize unravel_index `dims` alias for `shape` keywordSebastian Berg2020-12-021-11/+4
| | | | | | | | | | The argument was renamed to `shape` and deprecated since NumPy 1.16, so the deprecation can now be finalized.
* | 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.