summaryrefslogtreecommitdiff
path: root/numpy/testing
Commit message (Collapse)AuthorAgeFilesLines
...
* MAINT: Make decorator tests work with new exceptions.Charles Harris2017-12-221-8/+8
| | | | | | | 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.
* ENH: Add pytest_tools directory.Charles Harris2017-12-226-0/+3452
| | | | | | | | | | | | | | Create numpy/testing/pytest_tools and populate it with pytest compatible versions of * decorators.py * utils.py * noseclasses.py * nosetester.py Note that noseclasses and nosetester are basically dummy modules at this point, they don't do anything, but they do import when nose is not present. Fixing the test runners is for another PR.
* DOC: fix minor typosUnknown2017-12-121-1/+1
|
* BUG: Fix numpy.testing.assert_equal in release mode.Charles Harris2017-12-101-3/+6
| | | | | | | | To be complete, the NaT handling needs to raise AssertionError when comparing NaT's with different types. That check was previously passed on and the resulting check, which would succeed in development mode because DeprecationWarning was converted to an error, warns in release mode.
* MAINT/BUG: Simplify _formatArray, fixing array_repr(matrix) in the processEric Wieser2017-12-061-1/+3
| | | | | | | | 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.
* Merge pull request #10114 from Templarrr/masterCharles Harris2017-11-281-2/+1
|\ | | | | MAINT: Remove duplicate cond check from assert_array_compare
| * MAINT: Remove duplicate cond check from assert_array_compareMichael Odintsov2017-11-281-2/+1
| | | | | | We already in "if not cond" branch of code, we don't need to check it again
* | MAINT: Simplify IntegerFormatterEric Wieser2017-11-281-6/+9
|/ | | | | | 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
* BUG: Fix assert_equal on time-like objectsEric Wieser2017-11-262-28/+46
| | | | | | Also does some cleanup on the float assert_equal to make it look more similar. Fixes #10081
* Merge pull request #9645 from xoviat/appveyorCharles Harris2017-09-301-9/+12
|\ | | | | ENH: enable OpenBLAS on windows.
| * TST: utils: fix string continuationxoviat2017-09-091-6/+6
| |
| * :art:xoviat2017-09-091-1/+1
| |
| * TST: util: fix test_error_messagexoviat2017-09-091-1/+1
| | | | | | use the correct replace() order
| * TST: utils: fix test_error_msgxoviat2017-09-091-7/+8
| | | | | | Allow the error message to contain "large" arrays.
| * TST: fix failures:xoviat2017-09-041-1/+3
| | | | | | | | | | | | 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.
* | TST: update tests to remove unneeded whitespaceAllan Haldane2017-09-251-12/+12
|/
* ENH: check for FPU mode changes in the test suitePauli Virtanen2017-08-162-3/+38
| | | | | Emit a test failure if the FPU mode changes when running a test case, allowing to pinpoint what test caused the mode change.
* 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/DOC: Use builtin when np.{x} is builtins.{x}.Eric Wieser2017-08-051-3/+3
| | | | | | | 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
* TST: Add test of new `parametrize` decorator.Charles Harris2017-07-051-0/+14
| | | | | The new decorator was added to numpy.testing in order to facilitate the transition to using pytest.
* ENH: Add parametrize decorator for nose.Charles Harris2017-07-052-0/+506
| | | | | | | | | | One of the steps in achieving pytest compatibility is to get rid of yield based nose tests. Having some basic version of parametrize offers a way to do that. Note that the version here is very restricted and does not have all the capabilities of the pytest version. Such are the drawbacks of backward compatibility.
* MAINT: Rearrange files in numpy/testing module.Charles Harris2017-07-0411-3358/+3407
| | | | | | | | | | | | | | | | | 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: Move nose plugin initialization outside of testing loopSebastian Berg2017-06-271-3/+3
| | | | | | | It seems ok to let this warning show up, and it does not directly relate to the test run itself, so moving it before setting up the warnings for the actual tests (and printing out the system info, so that it is not confused to originate in the actual tests).
* ENH: testing: add a "timer" keyword to ``Tester.test`` to time slow tests.Ralf Gommers2017-06-211-3/+15
| | | | Useful because no one can remember the magic ``extra_argv`` incantation.
* ENH: testing: load available nose plugins that are external to nose itselfRalf Gommers2017-06-211-0/+11
| | | | | | | Motivation is to be able to use `nose-timer` within the test() function. Try (after installing nose-timer): np.test(extra_argv=['--with-timer', '--timer-top-n', '20'])
* BUG: KeyboardInterrupt is swallowed all over the placeEric Wieser2017-06-031-2/+2
| | | | Bare except is very rarely the right thing
* ENH: Spelling fixesVille Skyttä2017-05-091-2/+2
|
* BUG: Remove warning filters from comparison assert functionsSebastian Berg2017-05-072-38/+75
| | | | | | | | | 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.
* DEP: Add back ndarray.__[sg]etslice__Eric Wieser2017-04-191-0/+2
| | | | These now delegate to __getitem__, so subclasses no longer need to define them
* MAINT: Remove __setslice__ and __getslice__Eric Wieser2017-02-091-2/+0
| | | | | This code was only here for Python 2.5 compatibility, but numpy requires 2.7 at minimum
* Add missing __tracebackhide__ to testing functions.Antony Lee2017-02-041-0/+2
|
* Ensure inf/nan removal in assert_array_compare is matrix-safe.Marten van Kerkwijk2017-01-112-8/+44
|
* BUG assert_almost_equal fails on subclasses that cannot handle boolMarten van Kerkwijk2017-01-092-17/+40
| | | | | | | | | | | | 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.
* BUG: corrected behavior for assert_array_lessJonathan Tammo Siebert2017-01-041-18/+20
| | | | | | | | | | | | | | | | See issue #2418 assert_array_less does now treat inf/nan correctly, namely: -inf < x < inf for any real number x nans still are not compared, when they occur at the same position To achieve this without breaking any other functions relying on assert_array_compare, an additional parameter (equal_inf) was introduced that defaults to the old behavior (analogous to equal_nan).
* TST: Added test that np.inf is not approx. -np.infJonathan Tammo Siebert2017-01-041-0/+5
| | | | | This failed to raise AssertionError in an earlier rewrite of assert_array_compare and is thus tested explicitly now.
* TST: Added unit tests for assert_array_lessJonathan Tammo Siebert2017-01-041-0/+140
| | | | | | | | | 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.
* DEP: Fix escaped string characters deprecated in Python 3.6.Charles Harris2016-12-142-3/+3
| | | | | | | In Python 3.6 a number of escape sequences that were previously accepted -- for instance "\(" that was translated to "\\(" -- are deprecated. To retain the previous behavior either raw strings must be used or the backslash must be properly escaped itself.
* MAINT: make regex strings rawJulian Taylor2016-12-121-5/+5
| | | | | Python 3.6 gets more strict about escape sequences, \. is invalid. As it could get a syntax error the version check would not work.
* BUG: Fix suppress_warnings (again) for Python 3.6.Charles Harris2016-12-071-10/+0
| | | | | The Python 3.6 changes that resulted in the 6b49167c fix has been fixed in Python 3.6.0rc1. So revert our fixes.
* ENH: Deprecation warnings for `/` integer division when running python -3saurabh2016-11-011-1/+14
| | | | | | When python is invoked with switch -3, it emits waring "classic int division" for strict integer divisions. The same behavior is now implemented to numpy with this fix
* MAINT: make `assert_allclose` behavior on `nan`s match pre 1.12Josh Wilson2016-10-192-3/+15
|
* MAINT: Add python 3.6 support to suppress_warningsSebastian Berg2016-10-191-3/+26
| | | | | | | | | | | | Python 3.6 has two methods for showing warnings, so we have to support both ways (strictly speaking, on python 3.6 itself only the new would probably be needed). Also adds the _filters_mutated() call to replace manual registry clearing. This is basically the fix that newer python versions have to avoid the issue making the manual clearing unnecessary. Closes gh-8176
* BUG: Make assert_allclose(..., equal_nan=False) work.Antti Kaihola2016-10-171-9/+13
| | | | | | | | | As discussed in my comments for issue #8145, this patch adds the equal_nan argument to assert_array_compare(), and assert_allclose() passes the value it receives for the same argument through to assert_array_compare(). Closes #8142.
* TST: Add tests for assert_allclose(..., equal_nan={True|False})Antti Kaihola2016-10-171-0/+12
|
* MAINT: fix assert_raises_regex when used as a context managerStephan Hoyer2016-09-261-8/+13
| | | | | Formerly, I got DeprecationWarnings about callable being None when I tested on Python 3.
* Update somethingaboutorange URL to nose.readthedocs.ionaveenarun2016-09-211-1/+1
|
* Merge pull request #7099 from seberg/suppressed_warningsCharles Harris2016-09-025-50/+56
|\ | | | | Suppressed warnings
| * ENH: Use new context manager for testingSebastian Berg2016-09-021-16/+27
| | | | | | | | | | | | Making the outer context manager a suppress warnings gives good control to print warnings only once in release mode and suppress some specific warnings which cannot be easily avoided otherwise.
| * BUG: Suppress common NaT warningsSebastian Berg2016-09-021-4/+9
| | | | | | | | | | | | | | | | | | Printing of datetime arrays used to cause warning due to comparison warnings in NaT. This is circumvented by using views to integer values. Part of this should be simplified when the deprecation is over. Also fixes a bug with non-native byteorder.
| * ENH: Make warning testing context managers more specificSebastian Berg2016-09-022-15/+8
| | | | | | | | | | | | | | 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.