| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|
|
|
| |
It's not always possible to guarantee this, so also adds a test to verify that we don't hang
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
That function is nose specific and has not worked since `__init__` files
were added to the tests directories.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This removes a few left over uses of unittest. The main changes apart
from removal of Test case are:
* `setUp` replaced by nose and pytest compatible `setup`
* `tearDown` replaced by nose and pytest compatible `teardown`
* `assertRaises` replaced by `assert_raises`
* `assertEqual` replaced by `assert_equal`
The last two are in `numpy/testings/tests/test_utils.py`, so may seem a
but circular, but at least are limited to those two functions.
The use of `setup` and `teardown`, can be fixed up with the pytest
equivalents after we have switched to pytest.
|
|
|
|
|
|
| |
The contents of the module warnings registries was made more module
specific in Python 3.7 and consequently the tests of the context
managers clear_and_catch_warnings and suppress_warnings need updating.
|
| |
|
| |
|
|
|
|
|
|
|
| |
The KnowFailureException and SkipTest for pytest have delayed imports of
_pytest in order to avoid a hard dependence on pytest. They return the
pytest types XFailed and Skipped respectively when they are constructed,
so the tests need to be adjusted to deal with that.
|
|
|
|
|
|
|
|
| |
Now:
* Has one recursive base case
* Is fewer lines of code
* Does not rstrip the result of format_function (none of the builtin ones have trailing spaces anyway)
* Recurses in the index, instead of the value, which handles `dtype=object` arrays without the need for the rank argument. This fixes #8442.
|
|
|
|
|
|
| |
This essentially reverts 83accefd143a0e3ee8b3160d0927b3ff616743de, which presumably worked around a bug in an ancient version of python
Similarly, the try/excepts here were to handle `IntegerFormatter` being called on the wrong type of array, which no longer happens
|
|
|
|
|
|
| |
Also does some cleanup on the float assert_equal to make it look more similar.
Fixes #10081
|
|\
| |
| | |
ENH: enable OpenBLAS on windows.
|
| | |
|
| | |
|
| |
| |
| | |
use the correct replace() order
|
| |
| |
| | |
Allow the error message to contain "large" arrays.
|
| |
| |
| |
| |
| |
| | |
1. fail tests related to DLL load failure as they were previously untested.
2. fix have_compiler to return false on old compilers
3. xfail some tests that were not working on old Python versions.
|
|/ |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
The new decorator was added to numpy.testing in order to facilitate the
transition to using pytest.
|
| |
|
|
|
|
|
|
|
|
|
| |
These warning filters are not threadsafe, while it is nicer if the
comparison functions can be called in a threaded environment since
they do no explicite warning checking.
Less filters are also cleaner in general, though may also mean that
downstream projects see warnings that were previously hidden.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
gh-8410 breaks a large number of astropy tests, because it sets up
a boolean array for values that should actually be compared (i.e.,
are not `nan` or `inf`) using `zeros_like`. The latter means that
for subclasses, the boolean test array is not a plain `ndarray` but
the subclass. But for astropy's `Quantity`, the `all` method is
undefined.
This commit ensures the test arrays from `isinf` and `isnan` are
used directly.
|
|
|
|
|
| |
This failed to raise AssertionError in an earlier rewrite of
assert_array_compare and is thus tested explicitly now.
|
|
|
|
|
|
|
|
|
| |
Added tests for simple arrays/elements,
tests that ensure that nans are not compared when they are in the same
position in both arrays but raise AssertionError when they are not,
and tests that ensure inf logic
(-np.inf < np.inf, 1.0 < np.inf, -np.inf < 1.0)
and that all other cases fail.
|
| |
|
| |
|
|
|
|
|
|
|
| |
This means that warnings of different origin then the one tested for
behave normally. If the normal behaviour is to igonre them this might
decrease specificity in rare cases. In most cases the specificity
will be slightly higher.
|
|
|
|
|
| |
Also modify the corresponding test to suppress the non Deprecation
warnings created to test specificity.
|
| |
|
|
|
|
|
|
| |
This context has a couple of advantages over the typical one, and can
ensure that warnings are cleanly filtered without side effect for
later tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes the check for scalars in assert_almost_equal so that
abs(actual - desired) < 1.5 * 10**(-decimal)
Note that the previous documentation claimed that the functions were
equivalent to
abs(actual - desired) < .5 * 10**(-decimal)
but that was not how they behaved in practice.
Due to the change in implementation, some very delicate tests may fail
that did not fail before. No extra failures were noted in scipy.
Closes #5200.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
assert_equal(np.array([0, 1]), np.matrix([0, 1]))
used to print
x: array([0, 1])
y: [repr failed]
now prints
x: array([0, 1])
y: [repr failed for <matrix>: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()]
|
|\
| |
| | |
Revert "Merge pull request #7001 from shoyer/NaT-comparison"
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 7141f40b58ed1e7071cde78ab7bc8ab37e9c5983,
reversing changes made to 8fa6e3bef26a6d4a2c92f2824129aa4409be2590.
The original broke some pandas tests. The current plan to get this
in is
* reversion
* issue FutureWarning in 1.11 and 1.12
* make the change in 1.13.
|
|/ |
|
|
|
|
|
|
|
|
|
| |
Now, NaT compares like NaN:
- NaT != NaT -> True
- NaT == NaT (and all other comparisons) -> False
We discussed this on the mailing list back in October:
https://mail.scipy.org/pipermail/numpy-discussion/2015-October/073968.html
|
|
|
|
|
| |
The test is in numpy/lib/tests/test_io.py. This commit is intended
as a demonstration of using temppath.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Context manager intended for use when the same temporary file needs to
be opened and closed more than once. The context manager creates the
file, closes it, and returns the path to the file. On exit from the
context block the file is removed. The file should be closed before
exiting the context as an error will be raised on windows if not.
Also fix up the `tempdir` context manager to deal with exceptions.
Tests are added for both `temppath` and `tempdir`.
|
|
|
|
|
|
|
|
| |
* use SkipTest in numpy tests instead of importing it from nose
* add a KnownFailureException as an alias for KnownFailureTest
(the former is preferred, but the latter is kept for backcompat)
* rename the KnownFailure nose plugin into KnownFailurePlugin,
and keep the old name for backcompat
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Add context manager for tests that, on entry, clears record of any
previous warnings from given modules, so that any warning raised in the
context block does get raised, rather than suppressed by a previous
warning causing an entry in the `__warningregistry_`` of the module.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fix addresses Issue #347.
All of the tests in this class were using random numbers generated
without a seed. This broke `test_simple` in a nondeterministic manner.
Rewrote all tests for this function. Instead of using random numbers,
well-defined arrays of widely varying amplitude were created instead.
Changed the array modification values so that the test arrays were
either just above or just below the NULP threshold.
Added tests for float64, float32, complex128, and complex64 dtypes, and
added both addition and subtraction tests. Tried to standardize the code
for all tests.
|
|\
| |
| | |
BUG: fix array_almost_equal for array subclasses
|