| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|/ |
|
|
|
| |
* DOC: defaults in allclose not the same as in assert_allclose
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- Always enable __array_function__ overrides.
- Remove special cases for Python 2 compatibility.
- Document these changes in 1.17.0-notes.rst.
It will be good to see ASV numbers to understand the performance implications
of these changes. If need be, we can speed up NumPy functions internally by
using non-dispatched functions (with ``.__wrapped__``).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Example behavior:
>>> x = np.array([1, 2, 3])
>>> y = np.array([1, 2, 3.0001])
>>> np.testing.assert_allclose(x, y)
AssertionError:
Not equal to tolerance rtol=1e-07, atol=0
Mismatch: 33.3%
Max absolute difference: 0.0001
Max relative difference: 3.33322223e-05
x: array([1, 2, 3])
y: array([1. , 2. , 3.0001])
Motivation: when writing numerical algorithms, I frequently find myself
experimenting to pick the right value of `atol` and `rtol` for
`np.testing.assert_allclose()`. If I make the tolerance too generous, I risk
missing regressions in accuracy, so I usually try to pick the smallest values
for which tests pass. This change immediately reveals appropriate values to
use for these parameters, so I don't need to guess and check.
|
|
|
|
|
|
|
|
| |
* ported the refguide_check module from SciPy for usage
in NumPy docstring execution/ verification; added the
refguide_check run to Azure Mac OS CI
* adjusted NumPy docstrings such that refguide_check passes
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#12448)
* Review F401,F841,F842 flake8 errors (unused variables, imports)
* Review comments
* More tests in test_installed_npymath_ini
* Review comments
|
| |
|
| |
|
|\
| |
| | |
BUG: Fix misleading assert message in assert_almost_equal #12200
|
| |
| |
| |
| |
| | |
Fixes #12200 by making a copy of the matrix before NaN's are excluded.
Add a test for it.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ENH: __array_function__ support for np.lib, part 2
xref GH12028
np.lib.npyio through np.lib.ufunclike
* Fix failures in numpy/core/tests/test_overrides.py
* CLN: handle depreaction in dispatchers for np.lib.ufunclike
* CLN: fewer dispatchers in lib.twodim_base
* CLN: fewer dispatchers in lib.shape_base
* CLN: more dispatcher consolidation
* BUG: fix test failure
* Use all method instead of function in assert_equal
* DOC: indicate n is array_like in scimath.logn
* MAINT: updates per review
* MAINT: more conservative changes in assert_array_equal
* MAINT: add back in comment
* MAINT: casting tweaks in assert_array_equal
* MAINT: fixes and tests for assert_array_equal on subclasses
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Otherwise the deprecation message is not that helpful as I have to dig
through the source to find out since when and whether conditional import
is necessary in my code. I may not have numpy on my dev machine (this
message was on CI). So it's one extra step for the consumer.
That's also for you, you have more chance of having consumer update
their code when they have more informations in the deprecation message,
so you can drop old code faster !
At least kudo to Charles Harris for including a comments just above,
that prevented me from having to git blame and go spelunking for knowing
which versions were or not affected.
|
|
|
|
|
|
|
|
|
|
| |
* previously, stochastic failures were possible
when running the NumPy test suite in parallel
because of an assumption made by assert_warn_len_equal()
* we now guard against this failure by gracefully
handling the testing contexts of both serial and
parallel execution of the module
|
|
|
|
|
|
|
|
| |
After the pytest migration, test classes no longer inherit
from unittest.TestCase and and the fail method does not
exist anymore.
In all these cases, we can use assert_raises and assert_raises_regex instead
|
| |
|
| |
|
|\
| |
| | |
MAINT: Make assert_array_compare more generic.
|
| |
| |
| |
| |
| |
| |
| | |
Use np.all instead of the *.all method to be a bit more robust against
bad subclasses of ndarray that may change the behavior of the method.
Closes #11743.
|
|/ |
|
| |
|
|
|
|
|
|
|
|
| |
unnecessary import dependencies
pytesttester is used by every single subpackage, so making it depend on np.testing just creates cyclic dependencies that can lead to circular imports
Relates to #11457
|
| |
|
|\
| |
| | |
BUG,MAINT: Ensure masked elements can be tested against nan and inf.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
|/
|
|
| |
Since this is now in `np.testing._private`, it's no longer usable by the outside world anyway
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
The underlying problem is that ma.all() evaluates to masked,
which is falsy, and thus triggers test failures.
|
|\
| |
| | |
Move remaining Matrix tests to matrixlib
|
| | |
|
|/
|
|
|
|
|
|
|
| |
User- and non-user-facing typos.
Some source typos fixes as well.
Found via `codespell`.
|
|
|
|
| |
It's not always possible to guarantee this, so also adds a test to verify that we don't hang
|
|
|
|
|
|
|
|
|
| |
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>]
|
|
|
|
|
|
| |
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
|
|\
| |
| | |
DEP: Issue deprecation warnings for some imports.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The following modules have been moved or renamed and should not be
imported. This adds shim modules for the old names that issue a
DeprecationWarning on import.
* numpy/core/umath_tests.py
* numpy/testing/decorators.py
* numpy/testing/noseclasses.py
* numpy/testing/nosetester.py
* numpy/testing/utils.py
Closes #10845.
|
| | |
|
|/
|
|
|
| |
That function is nose specific and has not worked since `__init__` files
were added to the tests directories.
|
|
|
|
|
|
|
|
| |
Numpy can now be tested using the standard
`python -c"import numpy; numpy.test()"`
construct.
|
|
|
|
|
|
|
|
|
|
|
| |
Use standard pytest markers everywhere in the numpy tests. At this point
there should be no nose dependency. However, nose is required to test
the legacy decorators if so desired.
At this point, numpy test cannot be run in the way with runtests, rather
installed numpy can be tested with `pytest --pyargs numpy` as long as
that is not run from the repo. Run it from the tools directory or some
such.
|
|
|
|
|
|
|
|
| |
* Make PytestTester callable.
* Rename 'timer' to 'durations', corresponding with pytest.
* Offset 'verbose', no entry is now '-q'.
* Move some `ignore` warnings into PytestTester so that they
affect releases, not just develop.
|
|
|
|
|
|
| |
[ci skip]
This is not used yet, but has been tested with temporary changes
and works.
|
|\
| |
| | |
BUG: Fix obvious warning bugs.
|
| |
| |
| |
| | |
The warning type is the second, not the first, argument.
|
|/
|
| |
Found via `codespell -q 3 -I ../numpy-whitelist.txt`
|
| |
|
|
|
|
|
| |
Downstream projects were importing directly from the testing modules
rather than from testing. Discourage this.
|