summaryrefslogtreecommitdiff
path: root/numpy/testing/tests/test_utils.py
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: remove `NUMPY_EXPERIMENTAL_ARRAY_FUNCTION` env varRalf Gommers2023-03-121-3/+0
| | | | | | | | As discussed in https://mail.python.org/archives/list/numpy-discussion@python.org/thread/UKZJACAP5FUG7KP2AQDPE4P5ADNWLOHZ/ This flag was always meant to be temporary, and cleaning it up is long overdue.
* MAINT: Remove all nose testing support.Charles Harris2023-01-191-36/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | NumPy switched to using pytest in 2018 and nose has been unmaintained for many years. We have kept NumPy's nose support to avoid breaking downstream projects who might have been using it and not yet switched to pytest or some other testing framework. With the arrival of Python 3.12, unpatched nose will raise an error. It it time to move on. Decorators removed - raises - slow - setastest - skipif - knownfailif - deprecated - parametrize - _needs_refcount These are not to be confused with pytest versions with similar names, e.g., pytest.mark.slow, pytest.mark.skipif, pytest.mark.parametrize. Functions removed - Tester - import_nose - run_module_suite
* TST,MAINT: Replace most `setup` with `setup_method` (also teardown)Sebastian Berg2022-10-271-7/+7
| | | | | | | | In some cases, the replacement is clearly not what is intended, in those (where setup was called explicitly), I mostly renamed `setup` to `_setup`. The `test_ccompile_opt` is a bit confusing, so left it right now (this will probably fail)
* Merge pull request #21795 from hmaarrfk/no_overflow_unsignedSebastian Berg2022-07-061-0/+14
|\ | | | | ENH: Ensure that assertion of unsigned dtypes does not return results
| * TST: Add a failing test case to demonstrate the bug gh2176Mark Harfouche2022-06-291-0/+14
| |
* | ENH: Add strict parameter to assert_array_equal. (#21595)Jon Morris2022-06-241-0/+37
|/ | | | | | Fixes #9542 Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com>
* MAINT: revert changes, so all tests pass for warning contextsBrigitta Sipőcz2022-05-231-14/+7
|
* MAINT: Fix warningc context tests, uncover bug?Brigitta Sipőcz2022-05-231-6/+20
|
* MAINT: Python <3.8 related cleanupsBrigitta Sipőcz2022-05-231-11/+9
|
* MAINT: Python <3.7 related cleanupsBrigitta Sipőcz2022-05-231-7/+0
|
* Merge pull request #19226 from ↵Matti Picus2022-05-191-4/+3
|\ | | | | | | | | seberg/fix-void-cast-safety-promotion-and-comparison API: Fix structured dtype cast-safety, promotion, and comparison
| * API: Fix structured dtype cast-safety, promotion, and comparisonSebastian Berg2022-05-091-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR replaces the old gh-15509 implementing proper type promotion for structured voids. It further fixes the casting safety to consider casts with equivalent field number and matching order as "safe" and if the names, titles, and offsets match as "equiv". The change perculates into the void comparison, and since it fixes the order, it removes the current FutureWarning there as well. This addresses https://github.com/liberfa/pyerfa/issues/77 and replaces gh-15509 (the implementation has changed too much). Fixes gh-15494 (and probably a few more) Co-authored-by: Allan Haldane <allan.haldane@gmail.com>
* | Remove python <3.6 related thingsBrigitta Sipocz2022-05-171-11/+5
|/
* ENH: Suppress over-/underflow RuntimeWarning in assert_array_equal (#21003)Simon Surland Andersen2022-02-081-0/+8
| | | | | | | | | | | * TST: Test suppression of asset_array_equal RuntimeWarning See #18992 * ENH: Suppress over-/underflow warnings on asset_array_equal - Closes #18992 * MAINT: Resolve linting issues of prior commit * MAINT: Simplified ignore and test case of asset_array_equal * MAINT: Removed unused import in test_utils.py
* MAINT: use super() as described by PEP 3135Mike Taves2021-03-191-4/+4
|
* BUG: Allow unmodified use of isclose, allclose, etc. with timedeltaSebastian Berg2021-02-041-0/+5
| | | | | | | | | | | | | | Disallowing timedelta64+float promotion (to timedelta64) in all cases (previously it was assymetric and "half allowed") meant that isclose, allclose, np.ma.allclose, and assert_arrays_almost_equal (which uses isclose), would stop work for timedelta64. Hardcoding that timedelta64 is passed on unmodified retains the old behaviour. It may make sense to deprecate or change this behaviour in the future, but for the 1.20 release, the behaviour should be as much unmodified as possible. Closes gh-18286
* MAINT: Remove old sys.version_info codeHugo2020-09-031-1/+1
|
* MAINT: Move and improve test_ignore_nan_ulperror.Charles Harris2020-06-141-0/+33
| | | | | | | Move test_ignore_nan_ulperror to `numpy/testing/tests/test_utils.py and extend to all floating types. Closes 16600.
* MAINT: cleanup unused imports; avoid redefinition of importsMike Taves2020-02-061-1/+0
| | | | | | | * Cleanup unused imports (F401) of mostly standard Python modules, or some internal but unlikely referenced modules * Where internal imports are potentially used, mark with noqa * Avoid redefinition of imports (F811)
* MAINT: Python2 CleanupsSeth Troisi2020-01-211-18/+0
|
* MAINT: Remove implicit inheritance from object class (#15236)Jon Dufresne2020-01-051-14/+14
| | | | | | | Inheriting from object was necessary for Python 2 compatibility to use new-style classes. In Python 3, this is unnecessary as there are no old-style classes. Dropping the object is more idiomatic Python.
* MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-031-2/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* TST: Add assert_array_equal test for big integer arraysMaxwell Aladago2019-12-251-0/+15
|
* MAINT: Fix randint 0d limits and other 0d cleanups (#15126)Nico Schlömer2019-12-181-3/+3
| | | * MAINT: only treat 0d case separately in randint, simplify some tests
* a separate test for scalars base on review commentsMaxwell Aladago2019-09-081-1/+11
|
* adding testsMaxwell Aladago2019-09-061-0/+10
|
* BUG: Fixed maximum relative error reporting in assert_allclose (gh-13802)CakeWithSteak2019-09-051-0/+9
| | | | | | Fixed maximum relative error reporting in assert_allclose: In cases where the two arrays have zeros at the same positions it will no longer report nan as the max relative error
* ENH: Improve mismatch message of np.testing.assert_array_equal (#14203)Tim Hoffmann2019-08-151-5/+6
| | | | | The original message included "Mismatch: 33.3%". It's not obvious what this percentage means. This commit changes the text to "Mismatched elements: 1 / 3 (33.3%)".
* Merge pull request #13627 from shoyer/revert-nep18-implMatti Picus2019-05-281-0/+3
|\ | | | | MAINT: revert __skip_array_function__ from NEP-18
| * MAINT: Fixes tests with __array_function__ disabledStephan Hoyer2019-05-261-0/+3
| |
* | BUG: special case object arrays when printing rel-, abs-errormattip2019-05-271-0/+7
|/
* TEST: tweak two slow tests to speed them upmattip2019-05-111-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-011-52/+63
| | | | | | | | | | | | | | | | | | | | | | 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.
* MAINT: Review F401,F841,F842 flake8 errors (unused variables and imports) ↵Roman Yurchak2018-12-061-1/+1
| | | | | | | | | | | | (#12448) * Review F401,F841,F842 flake8 errors (unused variables, imports) * Review comments * More tests in test_installed_npymath_ini * Review comments
* MAINT: more fixes for disabling overridesStephan Hoyer2018-11-101-6/+3
|
* Merge pull request #12243 from liwt31/fix_misleading_msgMatti Picus2018-10-231-2/+16
|\ | | | | BUG: Fix misleading assert message in assert_almost_equal #12200
| * BUG: Fix misleading assert message in assert_almost_equal #12200wtli@Dirac2018-10-231-2/+16
| | | | | | | | | | 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-221-0/+38
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* 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: reformat line spacing before test methodsmattip2018-08-191-2/+0
|
* BUG: Make assert_string_equal check str equality simply without regexSho Nakamura2018-07-141-0/+6
|
* MAINT: clean up assert_array_compare a bit further.Marten van Kerkwijk2018-06-041-0/+6
| | | | | | | | | | | | | | 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-0/+12
| | | | | | | 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: Ensure that fully masked arrays pass assert_array_equal.Marten van Kerkwijk2018-05-191-0/+18
| | | | | The underlying problem is that ma.all() evaluates to masked, which is falsy, and thus triggers test failures.
* MAINT: move matrix tests in testing to matrixlib.Marten van Kerkwijk2018-04-291-30/+2
|
* BUG: Ensure the garbage is clear first in assert_no_gc_cyclesEric Wieser2018-04-151-18/+65
| | | | It's not always possible to guarantee this, so also adds a test to verify that we don't hang
* TST: Extract a helper function to test for reference cyclesEric Wieser2018-04-121-1/+28
| | | | | | 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: Remove all uses of run_module_suite.Charles Harris2018-04-061-10/+5
| | | | | That function is nose specific and has not worked since `__init__` files were added to the tests directories.