summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: Various minor code cleanups.Charles Harris2017-11-242-62/+73
| | | | Minor cleanups of old code to reflect more modern usage.
* MAINT: Refactor some code in npyio.py.Charles Harris2017-11-211-2/+0
|
* ENH: Add encoding option to numpy text IO.Julian Taylor2017-11-212-93/+422
| | | | | | | | | | | This modifies loadtxt and genfromtxt in several ways intended to add unicode support for text files by adding an `encoding` keyword to np.load, np.genfromtxt, np.savetxt, and np.fromregex. The original treatment of the relevant files was to open them as byte files, whereas they are now opened as text files with an encoding. When read, they are decoded to unicode strings for Python3 compatibility, and when written, they are encoded as specified. For backward compatibility, the default encoding in both cases is latin1.
* ENH: Make `np.in1d()` work for unorderable object arrays (#9999)Jörg Döpfert2017-11-181-0/+31
|
* ENH: Add `order=` keyword to `np.eye()` (#9996)Danny Hermes2017-11-121-0/+9
| | | Fixes #9995
* ENH: add Decimal support to numpy.lib.financial (#9952)Garry Polley2017-11-111-61/+238
| | | | | Adds support for Decimal to the rate, pv, fv, pmt, ppmt, ipmt, mirr, npv functions Closes #9781
* BUG: Throw an error if too many functions are given to piecewiseEric Wieser2017-10-231-0/+10
| | | | Especially necessary given the strange heuristics that decay the number of conditions to 1
* TST: Add test for 0d conditions in np.piecewiseEric Wieser2017-10-221-0/+6
|
* MAINT/BUG: Remove special-casing for 0d arrays, now that indexing with a ↵Eric Wieser2017-10-211-1/+1
| | | | | | single boolean is ok Also fix the test added in gh-4792, which didn't make sense, but passed anyway
* Merge pull request #9065 from eric-wieser/deprecate-bincountCharles Harris2017-10-181-2/+2
|\ | | | | DEP: 0 should be passed to bincount, not None
| * MAINT: improve wording of error messagesEric Wieser2017-10-171-2/+2
| |
* | BUG: Allow `unravel_index(0, ())` to return ()Eric Wieser2017-10-171-1/+12
|/ | | | Fixes gh-580
* Merge pull request #9294 from b-carter/fix_histogram_monotonicity_checkEric Wieser2017-09-241-0/+8
|\ | | | | BUG: Fixes histogram monotonicity check for unsigned bin values
| * TST: add test for unsigned bins monotonicity check, see #9222Brandon Carter2017-06-241-0/+8
| |
* | Merge pull request #9408 from eric-wieser/gradient-fixCharles Harris2017-09-211-1/+8
|\ \ | | | | | | BUG: various fixes to np.gradient
| * | BUG: Only allow 1d distance arraysEric Wieser2017-07-131-0/+4
| | | | | | | | | | | | | | | | | | 2d arrays would work, but in unpredictable and undocumented ways. This at least makes gh-9401 give a better error message.
| * | BUG: Allow 0d arrays instead of scalars in gradientEric Wieser2017-07-131-1/+4
| | | | | | | | | | | | This fixes gh-8292
* | | ENH Better error message for savetxt when X.ndim > 2Nelle Varoquaux2017-09-201-0/+6
| | | | | | | | | | | | | | | savetxt does not support saving arrays of dimension 0 or higher than 2. This pull request improves the message of the error raised.
* | | ENH: Align data in np.save() at 64 bytes (#9025)John Zwinck2017-09-131-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, saving format version 1 would align to 16 bytes, and saving version 2 would align improperly (bug #8085). Alignment is now always at least 64 bytes in either version, which supports memory mapping of the saved files on Linux, where mmap() offset must be a multiple of the page size. Why 64 bytes? Simply because we don't know of a case where more is needed. AVX alignment is 32 bytes; AVX-512 is 64. Fixes #8085, closes #8598.
* | | TST: Fix/Remove old unit tests for structure assignmentAllan Haldane2017-09-071-2/+2
| | |
* | | BUG: fix padding an empty array in reflect mode.Iryna Shcherbina2017-09-011-0/+7
| | | | | | | | | | | | Check that axes with non-zero padding are non-empty.
* | | BUG: fix infinite loop when creating np.pad on an empty arrayIryna Shcherbina2017-08-241-0/+4
| | |
* | | Merge pull request #9524 from charris/add_init_to_test_directoriesCharles Harris2017-08-121-0/+0
|\ \ \ | | | | | | | | TST, MAINT: Add `__init__.py` files to tests directories.
| * | | 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: Use moveaxis instead of rollaxis internally (#9475)Nico Schlömer2017-08-101-2/+2
|/ / / | | | | | | | | | | | | Also add a hint to the documentation advising the use of moveaxis over rollaxis. Tests for rollaxis are left alone.
* | | Merge pull request #9522 from eric-wieser/stop-using-obj2sctypeCharles Harris2017-08-061-1/+7
|\ \ \ | | | | | | | | BUG: Fix problems with obj2sctype
| * | | BUG: Don't allow an array to be passed as the dtype argumentEric Wieser2017-08-061-1/+7
| | | |
* | | | Merge pull request #9505 from eric-wieser/fix-issubdtypeCharles Harris2017-08-063-6/+6
|\ \ \ \ | |/ / / |/| | | BUG: issubdtype is inconsistent on types and dtypes
| * | | MAINT: Stop using the undocumented coercion-then-downcast feature of subdtypeEric Wieser2017-08-053-6/+6
| | | |
* | | | MAINT: Remove `level=` keyword from test arguments.Charles Harris2017-08-052-19/+17
|/ / / | | | | | | | | | | | | | | | I don't know what that argument was used for, but it showis up in old tests and is not explicitly used within the tests. I assume it was part of an old testing framework and is now longer needed.
* | | MAINT/DOC: Use builtin when np.{x} is builtins.{x}.Eric Wieser2017-08-055-36/+36
| | | | | | | | | | | | | | | | | | | | | 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
* | | MAINT: Changed diff to use iterative instead of recursive approachJoseph Fox-Rabinovitz2017-07-311-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TST: Added tests for `n` parameter Added test for `datetime64` type change Added tests for axis normalization Added test for subtype handling DOC: Minor updates to docs: Added explanation for `n==0` Added documentation describing `datetime64` handling Updated formatting Added call to normalize_axis_index
* | | Merge pull request #9434 from charris/remove-unittest-dependenciesCharles Harris2017-07-2417-328/+327
|\ \ \ | | | | | | | | Remove unittest dependencies
| * | | TST: Remove unittest dependencies in numpy/lib/tests.Charles Harris2017-07-2417-328/+327
| | | |
* | | | BUG: float16 is promoted to float64 by gradientEric Wieser2017-07-131-0/+6
|/ / / | | | | | | | | | This isn't the case for `diff`
* | | Merge pull request #9362 from charris/rearrange-testing-moduleCharles Harris2017-07-062-4/+2
|\ \ \ | | | | | | | | ENH: Rearrange testing module to isolate nose dependency.
| * | | MAINT: Rearrange files in numpy/testing module.Charles Harris2017-07-042-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | TST: join_by now works for dtypes with padding tooEric Wieser2017-07-011-0/+16
| | | | | | | | | | | | | | | | Once again, thanks to not using .descr
* | | | TST: Add failing test for mismatch of key typeEric Wieser2017-07-011-1/+16
| | | |
* | | | BUG: stack_arrays fails for subdtypesEric Wieser2017-07-011-0/+29
| | | | | | | | | | | | | | | | Again, fixed by not using descr
* | | | BUG: recfunctions.join_by fails when key is a subdtypeEric Wieser2017-07-011-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems that working with .descr is a generally terrible idea. Instead we introduce `get_fieldspec`, which returns a list of 2-tuples, encapsulating subdtypes. This also means that np.core.test_rational.rational survives a roundtrip - its .descr is 'V8', which ddoesn't survive
* | | | BUG: recfunctions.join_by fails for colliding values with different dtypesEric Wieser2017-07-011-0/+13
|/ / / | | | | | | | | | Fixes #9338
* | | TST: Verify that join_by doesn't choke on subdtypesEric Wieser2017-06-271-0/+10
| |/ |/|
* | BUG: Switched to xor for bool arrays in diff, added corresponding testsEgor Panfilov2017-06-171-1/+11
| |
* | BUG: KeyboardInterrupt is swallowed all over the placeEric Wieser2017-06-033-5/+5
| | | | | | | | Bare except is very rarely the right thing
* | BUG: have as_strided() keep custom dtypesAntoine Pitrou2017-05-241-0/+8
| | | | | | | | Fixes issue #9161
* | BUG: set default type for empty index array to `numpy.intp` (#9142)Konrad Kapp2017-05-201-0/+10
| | | | | | | | Fixes #9137
* | DEP: Deprecate incorrect behavior of expand_dims.Charles Harris2017-05-171-1/+22
|/ | | | | | | | | | | Expand_dims works as documented when the index of the inserted NewAxis in the resulting array satisfies -a.ndim - 1 <= index <= a.ndim. However, when index > a.ndim index is replaced by a.ndim and, when index < -a.ndim - 1, it is replaced by index + a.ndim + 1, which may be negative and results in incorrect placement. The latter two cases are now deprecated. Closes #9100.
* Merge pull request #9070 from ahaldane/silence_join_byEric Wieser2017-05-101-1/+14
|\ | | | | BUG: Preserve field order in join_by, avoids FutureWarning
| * BUG: Preserve field order in join_by, avoids FutureWarningAllan Haldane2017-05-091-1/+14
| | | | | | | | Fixes #8940