summaryrefslogtreecommitdiff
path: root/numpy/testing/_private/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* HTTP -> HTTPS, and other linkrot fixesMike Toews2018-06-161-4/+4
|
* Merge pull request #11122 from mhvk/assert-array-comparison-with-maskedCharles Harris2018-06-071-41/+35
|\ | | | | BUG,MAINT: Ensure masked elements can be tested against nan and inf.
| * MAINT: clean up assert_array_compare a bit further.Marten van Kerkwijk2018-06-041-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This brought to light two bugs in tests, which are fixed here, viz., that a sample ndarray subclass that tested propagation of an added parameter was incomplete, in that in propagating the parameter in __array_wrap__ it assumed it was there on self, but that assumption could be broken when a view of self was taken (as is done by x[~flagged] in the test routine), since there was no __array_finalize__ defined. The other subclass bug counted, incorrectly, on only needing to provide one type of comparison, the __lt__ being explicitly tested. But flags are compared with __eq__ and those flags will have the same subclass.
| * BUG,MAINT: Ensure masked elements can be tested against nan and inf.Marten van Kerkwijk2018-05-271-38/+29
| | | | | | | | | | | | | | The removal of nan and inf from arrays that are compared using test routines like assert_array_equal treated the two arrays separately, which for masked arrays meant that some elements would not be removed when they should have been. This PR corrects this.
* | BUG: Import WarningMessage from warnings.Charles Harris2018-06-041-0/+1
| |
* | MAINT: Remove dead code backporting py2.6 warningsEric Wieser2018-06-041-92/+0
|/ | | | Since this is now in `np.testing._private`, it's no longer usable by the outside world anyway
* TST: disable gc in refcount test (#11158)Matti Picus2018-05-241-5/+9
| | | | | | | The vectorize version of this test was failing consistently on several of the Appveyor builds, ever since a recent pytest upgrade. Our theory is that by random chance, things changed so that during the call to vectorize(op).__call__, python started running a garbage collection, which perturbed the refcounts that this test is checking. (Specifically this test is doing a weird thing and checking that the refcount of the object 1 doesn't decrease, and it's very plausible that some random bit of garbage was holding a reference to this object.) Disabling the gc during the test makes this kind of refcount assertion more reliable, and seems to have fixed the appveyor builds, so I guess it's good.
* BUG: Ensure that fully masked arrays pass assert_array_equal.Marten van Kerkwijk2018-05-191-1/+5
| | | | | The underlying problem is that ma.all() evaluates to masked, which is falsy, and thus triggers test failures.
* BUG: Ensure the garbage is clear first in assert_no_gc_cyclesEric Wieser2018-04-151-1/+8
| | | | It's not always possible to guarantee this, so also adds a test to verify that we don't hang
* ENH: Show the full list of leaked objectsEric Wieser2018-04-121-2/+21
| | | | | | | | | An example output for the test added in the previous commit is: AssertionError: Reference cycles were found when calling make_cycle: 1 objects were collected, of which 1 are shown below: list object with id=2279664872136: [<Recursion on list with id=2279664872136>, <Recursion on list with id=2279664872136>]
* TST: Extract a helper function to test for reference cyclesEric Wieser2018-04-121-1/+63
| | | | | | This also means we can now test that our test is actually able to detect the type of failure we expect Trying to give myself some tools to debug the failure at https://github.com/numpy/numpy/pull/10882/files#r180813166
* MAINT: Rearrange numpy/testing files.Charles Harris2018-03-291-0/+2274
This is to prepare for the switch to pytest. * Rename `numpy/testing/nose_tools` to `numpy/testing/_private`. * Redirect imports as needed. * Copy `_testutils.py` from scipy to `numpy/testing/_private`. * Rename `_testutils.py` to `_pytester.py` and remove unneeded bits.