summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #15534 from seberg/deprecate-abstract-scalar-typesMatti Picus2020-03-062-5/+5
|\ | | | | DEP: Do not allow "abstract" dtype conversion/creation
| * DEP: Do not allow "abstract" dtype conversion/creationSebastian Berg2020-02-062-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These dtypes do not really make sense as instances. We can (somewhat) reasonably define np.dtype(np.int64) as the default (machine endianess) int64. (Arguably, it is unclear that `np.array(arr_of_>f8, dtype="f")` should return arr_of_<f8, but that would be very noisy!) However, `np.integer` as equivalent to long, is not well defined. Similarly, `dtype=Decimal` may be neat to spell `dtype=object` when you intend to put Decimal objects into the array. But it is misleading, since there is no special meaning to it at this time. The biggest issue with it, is that `arr.astype(np.floating)` looks like it will let float32 or float128 pass, but it will force a float64 output! Arguably downcasting is a bug in this case. A related issue is `np.dtype("S")` and especially "S0". The dtype "S" does make sense for most or all places where `dtype=...` can be passed. However, it is conceptionally different from other dtypes, since it will not end up being attached to the array (unlike "S2" which would be). The dtype "S" really means the type number/DType class of String, and not a specific dtype instance.
* | BUG: Fixing result of np quantile edge caseEric Mariasis2020-02-281-0/+10
|/
* BUG: np.load does not handle empty array with an empty descr (#15397)Sha Liu2020-01-271-1/+3
| | | | | | | The bug occurs since numpy 1.16. Before that empty descr corresponds to `np.dtype([])`. This fixes the problem by following numpy 1.15's behavior. Closes gh-15396
* MAINT: Remove Python2 workaroundsSeth Troisi2020-01-231-1/+0
|
* MAINT: Clean up, mostly unused imports.Warren Weckesser2020-01-233-6/+1
|
* MAINT: Python2 CleanupsSeth Troisi2020-01-211-3/+2
|
* NEP: issue deprecation warning when creating ragged array (NEP 34)Matti Picus2020-01-212-15/+20
| | | | This implements NEP 34.
* MAINT: Remove sys.version checks in testsSeth Troisi2020-01-157-96/+38
|
* DOC: fix typosBrian Wignall2020-01-141-1/+1
|
* MAINT: Implement keyword-only arguments as syntaxEric Wieser2020-01-061-6/+3
| | | | Now that 2.7 is gone, there is no need to pop manually from kwarg dictionaries.
* MAINT: Remove implicit inheritance from object class (#15236)Jon Dufresne2020-01-0519-155/+155
| | | | | | | Inheriting from object was necessary for Python 2 compatibility to use new-style classes. In Python 3, this is unnecessary as there are no old-style classes. Dropping the object is more idiomatic Python.
* MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-0324-48/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* BUG: lib: Fix handling of integer arrays by gradient.Warren Weckesser2020-01-011-0/+34
| | | | | | | In numpy.gradient, convert integer array inputs to float64 to avoid unwanted modular arithmetic. Closes gh-15207.
* MAINT: lib: Clean up in tests.Warren Weckesser2020-01-013-3/+0
| | | | * Remove a few unused imports in several files.
* Merge pull request #14981 from seberg/issue-13103Matti Picus2019-12-111-7/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit c088383cb290ca064d456e89d79177a0e234cb8d and uses the same kind casting rule for the additional keyword arguments ``to_end`` and ``to_begin``. This results in slightly more leniant behaviour for integers (which can now have overflows that are hidden), but fixes an issue with the handling of NaN. Generally, this behaviour seems more conistent with what NumPy does elsewhere. The Overflow issue exists similar in many other places and should be solved by integer overflow warning machinery while the actual cast takes place. Closes gh-13103
| * BUG: Make ``ediff1d`` kwarg casting consistentSebastian Berg2019-11-251-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit c088383cb290ca064d456e89d79177a0e234cb8d and uses the same kind casting rule for the additional keyword arguments ``to_end`` and ``to_begin``. This results in slightly more leniant behaviour for integers (which can now have overflows that are hidden), but fixes an issue with the handling of NaN. Generally, this behaviour seems more conistent with what NumPy does elsewhere. The Overflow issue exists similar in many other places and should be solved by integer overflow warning machinery while the actual cast takes place. Closes gh-13103
* | Revert "DEP: issue deprecation warning when creating ragged array (NEP 34)"revert-14794-nep-0034-implRalf Gommers2019-12-062-20/+15
| |
* | TST: fix up issues in requires_memory decoratorPauli Virtanen2019-12-041-1/+1
| | | | | | | | Fix wrong multiplier for /proc/meminfo, and do style cleanups.
* | Merge pull request #15023 from qwhelan/nan_perfMatti Picus2019-12-031-1/+28
|\ \ | | | | | | MAINT: Only copy input array in _replace_nan() if there are nans to replace
| * | PERF: only copy input array in _replace_nan() if there are nans to replaceChristopher Whelan2019-12-021-1/+28
| |/
* | Merge pull request #14794 from mattip/nep-0034-implRalf Gommers2019-12-022-15/+20
|\ \ | | | | | | DEP: issue deprecation warning when creating ragged array (NEP 34)
| * | TST: fix failing testmattip2019-10-311-1/+1
| | |
| * | DEP: issue deprecation warning when creating ragged array (NEP 34)mattip2019-10-311-14/+19
| | |
* | | ENH,DEP: Allow multiple axes in expand_dims (#14051)Larry Bradley2019-12-021-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | This PR allows the axis keyword in expand_dims to be a tuple of ints. Previously, axis could only be an int. This issue was previously discussed in gh-12290 and the changes are based on gh-12290 (comment). This PR also removes the deprecation added in v1.13 (2017-05-17), where previously axis could be outside of the range (-a.ndim - 1) <= axis <= a.ndim. Such an axis value will now raise an AxisError. Please let me know if it's too soon to remove this deprecation (I could not find any dev docs stating the length of the numpy deprecation cycle). Closes gh-12290.
* | | BUG: warn when saving dtype with metadata (#14994)Matti Picus2019-12-021-0/+30
| | | | | | | | | Address gh-14142 for the 1.18 release: warn when saving a dtype with metadata that cannot be loaded.
* | | TST: add pytest machinery to specify memory requirements for testsPauli Virtanen2019-12-011-5/+2
| |/ |/|
* | MAINT: Remove uses of scalar aliasesEric Wieser2019-11-132-15/+15
| | | | | | | | Relates to gh-6103
* | TST: Don't construct Fraction instances from numpy scalarsEric Wieser2019-10-301-2/+2
|/ | | | | | Fraction.__float__ gives a DeprecationWarning if the division results in a non-builtin float This was never intended as part of the test anyway.
* MAINT: deprecate financial functions.Warren Weckesser2019-10-161-0/+36
| | | | As per NEP-32, the financial functions are deprecated.
* BUG: lib: Fix histogram problem with signed integer arrays.Warren Weckesser2019-10-151-0/+11
| | | | | | | | | | | | | | | | | | | | An input such as np.histogram(np.array([-2, 0, 127], dtype=np.int8), bins="auto") would raise the exception ValueError: Number of samples, -1, must be non-negative. The problem was that the peak-to-peak value for the input array was computed with the `ptp` method, which returned negative values for signed integer arrays when the actual value was more than the maximum signed value of the array's data type. The fix is to use a peak-to-peak function that returns an unsigned value for signed integer arrays. Closes gh-14379.
* Merge pull request #14368 from jdufresne/byteswarningSebastian Berg2019-10-151-1/+1
|\ | | | | MAINT: Avoid BytesWarning in PyArray_DescrConverter()
| * MAINT: Avoid all BytesWarningJon Dufresne2019-09-251-1/+1
| | | | | | | | | | | | | | | | A BytesWarning can be emitted when bytes are and strings are mismatched. Catching BytesWarning ensures a better boundary between str and bytes type. The test suite is now run with the -b flag to emit this warning. Fixes #9308
* | Merge pull request #14583 from mattip/select-deprecationSebastian Berg2019-09-261-17/+7
|\ \ | |/ |/| DEP: remove deprecated select behaviour
| * DEP: remove expired deprecation in selectmattip2019-09-231-17/+7
| |
* | BUG: Add missing check for 0-sized array in ravel_multi_indexSebastian Berg2019-09-221-0/+18
|/ | | | | In wrap and clip modes ravel_multi_index crashes or gave invalid results if input arrays were empty but the shape not.
* Merge pull request #14511 from eric-wieser/fix-flatten_dtypeMatti Picus2019-09-161-4/+4
|\ | | | | BUG: Fix flatten_dtype so that nested 0-field structs are flattened correctly
| * BUG: Fix flatten_dtype so that nested 0-field structs are flattened correctlyEric Wieser2019-09-141-4/+4
| | | | | | | | This affects the behavior of merge_arrays.
* | Merge pull request #14510 from eric-wieser/fix-drop_fieldsMatti Picus2019-09-151-1/+3
|\ \ | | | | | | API: Do not return None from recfunctions.drop_fields
| * | API: Do not return None from recfunctions.drop_fieldsEric Wieser2019-09-141-1/+3
| |/ | | | | | | This return value was not documented and did not make any sense. There's no reason to have a special case here.
* | Merge pull request #14508 from Kai-Striega/financial_reviewSebastian Berg2019-09-141-0/+6
|\ \ | |/ |/| DOC: Add warning to NPV function
| * TST: Move NPV-IRR congruence check to testskai-striega2019-09-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | The internal rate of return (irr) is defined as the rate of return required for the net present values of a series of cashflows to be zero. i.e the lowest rate of return required for a project to break even. This is currently checked by refering to the example output from the ``irr`` and ``npv`` function documentation. This commit adds a test to confirm the identity holds.
* | Merge pull request #14255 from hgt312/fix_uniqueSebastian Berg2019-09-121-2/+5
|\ \ | | | | | | BUG: fix inconsistent axes ordering for axis in function `unique`
| * | fix uniqueHuang, Guangtai2019-08-131-2/+5
| | |
* | | Merge pull request #14209 from lagru/fix-linear-rampCharles Harris2019-09-051-8/+25
|\ \ \ | | | | | | | | BUG: Fix uint-overflow if padding with linear_ramp and negative gain
| * | | BUG: Replace _linear_ramp with linspaceLars Grueter2019-08-271-8/+25
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | linspace supports non-scalar values since version 1.16. This can replace the former _linear_ramp method. This removes a bug in the old implementation where certain edge and end values resulted in an integer underflow for unsigned dtypes (see gh-14191). Protect against this regression with a new test for all numeric dtypes.
* | | Merge pull request #14310 from ahaldane/fix_struct_to_unstruct_nestingCharles Harris2019-08-231-1/+36
|\ \ \ | | | | | | | | MAINT: Fix behavior of structured_to_unstructured on non-trivial dtypes
| * | | MAINT: fix behavior of structured_to_unstructured on non-trivial dtypesAllan Haldane2019-08-231-1/+36
| | |/ | |/| | | | | | | Fixes #13333
* | | Merge remote-tracking branch 'upstream/master' into fix-if-fieldsEric Wieser2019-08-1917-464/+1180
|\ \ \ | |/ /
| * | Merge pull request #14101 from lagru/zero_stat_lengthSebastian Berg2019-08-151-0/+23
| |\ \ | | | | | | | | MAINT: Clearer error message while padding with stat_length=0