summaryrefslogtreecommitdiff
path: root/numpy/testing
Commit message (Collapse)AuthorAgeFilesLines
...
* | DOC: testing: Mention the handling of nan in the assert_equal docstring.Warren Weckesser2019-05-051-0/+10
|/
* DOC: defaults in allclose not the same as in assert_allclose (#13395)Dieter Werthmüller2019-04-251-3/+3
| | | * DOC: defaults in allclose not the same as in assert_allclose
* MAINT: move gc.collect to function (from review)mattip2019-04-191-1/+19
|
* DEV: add pypy3 to azure CImattip2019-04-161-0/+1
|
* ENH: __array_function__ updates for NumPy 1.17.0Stephan Hoyer2019-01-221-3/+2
| | | | | | | | | | - 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__``).
* ENH: add "max difference" messages to np.testing.assert_array_equal (#12591)Stephan Hoyer2019-01-013-135/+185
| | | | | | | | | | | | | | | | | | | | | | 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.
* TST, DOC: enable refguide_checkTyler Reddy2018-12-141-3/+0
| | | | | | | | * 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
* MAINT: Review F401,F841,F842 flake8 errors (unused variables and imports) ↵Roman Yurchak2018-12-063-5/+4
| | | | | | | | | | | | (#12448) * Review F401,F841,F842 flake8 errors (unused variables, imports) * Review comments * More tests in test_installed_npymath_ini * Review comments
* Use set litteralsRoman Yurchak2018-11-241-1/+1
|
* MAINT: more fixes for disabling overridesStephan Hoyer2018-11-101-6/+3
|
* Merge pull request #12243 from liwt31/fix_misleading_msgMatti Picus2018-10-232-5/+22
|\ | | | | BUG: Fix misleading assert message in assert_almost_equal #12200
| * BUG: Fix misleading assert message in assert_almost_equal #12200wtli@Dirac2018-10-232-5/+22
| | | | | | | | | | 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/2 (#12119)Stephan Hoyer2018-10-222-11/+54
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* MAINT: add version since deprecation in the deprecation message.Matthias Bussonnier2018-09-254-8/+8
| | | | | | | | | | | | | | | 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.
* TST: improve parallel test stability for warningsTyler Reddy2018-09-231-1/+39
| | | | | | | | | | * 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
* TST: Replace calls to unittest.TestCase.fail (#11933)Roman Yurchak2018-09-121-5/+1
| | | | | | | | 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: remove redundant importsmattip2018-09-091-1/+0
|
* MAINT: reformat line spacing before test methodsmattip2018-08-192-3/+0
|
* Merge pull request #11756 from charris/fix-testing-utilsCharles Harris2018-08-171-6/+15
|\ | | | | MAINT: Make assert_array_compare more generic.
| * MAINT: Make assert_array_compare more generic.Charles Harris2018-08-171-6/+15
| | | | | | | | | | | | | | 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.
* | DOC: reduce warnings and cleanup redundant c-api documentationmattip2018-08-141-9/+11
|/
* BUG: Make assert_string_equal check str equality simply without regexSho Nakamura2018-07-142-2/+8
|
* MAINT: Move pytesttester outside of np.testing, to avoid creating ↵Eric Wieser2018-07-022-195/+1
| | | | | | | | 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
* HTTP -> HTTPS, and other linkrot fixesMike Toews2018-06-163-6/+6
|
* Merge pull request #11122 from mhvk/assert-array-comparison-with-maskedCharles Harris2018-06-072-41/+53
|\ | | | | 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-042-10/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-272-38/+41
| | | | | | | | | | | | | | 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-192-1/+23
| | | | | The underlying problem is that ma.all() evaluates to masked, which is falsy, and thus triggers test failures.
* Merge pull request #11010 from mhvk/poly-matrix-tests-to-matrixlibCharles Harris2018-05-151-30/+2
|\ | | | | Move remaining Matrix tests to matrixlib
| * MAINT: move matrix tests in testing to matrixlib.Marten van Kerkwijk2018-04-291-30/+2
| |
* | MAINT: Misc. typos (#11005)luzpaz2018-04-301-1/+1
|/ | | | | | | | | User- and non-user-facing typos. Some source typos fixes as well. Found via `codespell`.
* BUG: Ensure the garbage is clear first in assert_no_gc_cyclesEric Wieser2018-04-152-19/+73
| | | | 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-123-3/+92
| | | | | | 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
* Merge pull request #10850 from charris/deprecate-some-importsCharles Harris2018-04-094-9/+24
|\ | | | | DEP: Issue deprecation warnings for some imports.
| * DEP: Issue deprecation warnings for some imports.Charles Harris2018-04-064-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | MAINT: Remove now unused pytest_tools.Charles Harris2018-04-066-3465/+0
| |
* | MAINT: Remove all uses of run_module_suite.Charles Harris2018-04-062-16/+6
|/ | | | | That function is nose specific and has not worked since `__init__` files were added to the tests directories.
* TST: Update modules `test` to PytestTester.Charles Harris2018-04-041-2/+4
| | | | | | | | Numpy can now be tested using the standard `python -c"import numpy; numpy.test()"` construct.
* TST: Switch to using pytest markersCharles Harris2018-04-043-161/+186
| | | | | | | | | | | 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.
* TST: Update pytest.ini and PytestTesterCharles Harris2018-04-041-11/+30
| | | | | | | | * 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.
* ENH: Add tester for pytest.Charles Harris2018-03-311-0/+175
| | | | | | [ci skip] This is not used yet, but has been tested with temporary changes and works.
* Merge pull request #10830 from charris/fix-testing-warningsRalf Gommers2018-03-303-6/+6
|\ | | | | BUG: Fix obvious warning bugs.
| * BUG: Fix obvious warning bugs.Charles Harris2018-03-303-6/+6
| | | | | | | | The warning type is the second, not the first, argument.
* | DOC: Fix minor typosluz.paz2018-03-302-2/+2
|/ | | Found via `codespell -q 3 -I ../numpy-whitelist.txt`
* BUG: fix obvious mistake in testing/decorators warning.Ralf Gommers2018-03-291-2/+2
|
* MAINT: Warn when importing numpy.testing.<module>.Charles Harris2018-03-294-4/+18
| | | | | Downstream projects were importing directly from the testing modules rather than from testing. Discourage this.