summaryrefslogtreecommitdiff
path: root/numpy/testing/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #7042 from charris/revert-7001Charles Harris2016-01-161-45/+4
|\ | | | | Revert "Merge pull request #7001 from shoyer/NaT-comparison"
| * Revert "Merge pull request #7001 from shoyer/NaT-comparison"Charles Harris2016-01-161-45/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | DOC: document changes to assert_warnsStephan Hoyer2016-01-161-0/+4
| |
* | TST: Make assert_warns an optional contextmanagerStephan Hoyer2016-01-141-18/+51
|/
* TST, ENH: make all comparisons with NaT falseStephan Hoyer2016-01-141-4/+45
| | | | | | | | | 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
* DEP: deprecate np.testing.randEvgeni Burovski2016-01-041-0/+3
|
* Merge pull request #6866 from charris/tempfile-context-managerCharles Harris2015-12-201-4/+27
|\ | | | | ENH: Tempfile context manager
| * ENH: Add context manager `temppath` to manage a temporary file.Charles Harris2015-12-191-4/+27
| | | | | | | | | | | | | | | | | | | | | | | | 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`.
* | DOC: Use print only as function when print_function is imported from __future__gfyoung2015-12-191-1/+1
|/ | | | Closes gh-6863.
* ENH: testing: add SkipTest and KnownFailureExceptionEvgeni Burovski2015-11-161-2/+19
| | | | | | | | * 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
* BUG: testing: fix a bug in assert_string_equalPauli Virtanen2015-11-141-5/+6
|
* DOC: document that assert_raises can be used as a context managerEvgeni Burovski2015-11-121-0/+12
|
* Merge pull request #5773 from ml31415/pytest_traceback_hidePauli Virtanen2015-10-171-0/+15
|\ | | | | ENH: Hide testing helper tracebacks when using them with pytest
| * PEP8 applied to commentsMichael Löffler2015-05-141-15/+15
| |
| * Comments addedMichael Löffler2015-04-201-15/+15
| |
| * pytest traceback hide markers set for testing helpersMichael Löffler2015-04-191-0/+15
| |
* | BUG: Fixed import error on Windows from not correctly defining aIan Henriksen2015-07-131-20/+23
| | | | | | | | function listed in __all__ for numpy/testing/utils.py.
* | MAINT: pyflakes for numpy/testing, numpy/testing/tests.Charles Harris2015-07-051-45/+61
| |
* | STY: PEP8 fixes for numpy/testing numpy/testing/tests.Charles Harris2015-07-051-33/+40
| |
* | MAINT: move the special case for void comparison before the regular caseNathaniel J. Smith2015-06-131-3/+26
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | The ndarray richcompare function has special case code for handling void dtypes (esp. structured dtypes), since there are no ufuncs for this. Previously, we would attempt to call the relevant ufunc (e.g. np.equal), and then when this failed (as signaled by the ufunc returning NotImplemented), we would fall back on the special case code. This commit moves the special case code to before the regular code, so that it no longer requires ufuncs to return NotImplemented. Technically, it is possible to define ufunc loops for void dtypes using PyUFunc_RegisterLoopForDescr, so technically I think this commit changes behaviour: if someone had registered a ufunc loop for one of these operations, then previously it might have been found and pre-empted the special case fallback code; now, we use the special-case code without even checking for any ufunc. But the only possible use of this functionality would have been if someone wanted to redefine what == or != meant for a particular structured dtype -- like, they decided that equality for 2-tuples of float32's should be different from the obvious thing. This does not seem like an important capability to preserve. There were also several cases here where on error, an array comparison would return a scalar instead of raising. This is supposedly deprecated, but there were call paths that did this that had no deprecation warning. I added those warnings.
* ENH: add clear_and_catch_warnings context managerMatthew Brett2015-03-141-1/+63
| | | | | | | 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.
* DOC: Reconcile docstrings and function signatures where they disagreeRobert McGibbon2015-03-021-0/+2
| | | | | Fixed typos in docstrings were updated for functions where the parameter names in the docstring didn't match the function signature.
* MAINT: Minor code edits.chebee7i2015-02-221-1/+1
|
* ENH: Add `equal_nan` argument to allclose.chebee7i2015-02-201-2/+5
|
* Merge pull request #5374 from lebigot/patch-1Julian Taylor2014-12-241-1/+1
|\ | | | | | | DOC: Fixed incorrect assert_array_almost_equal_nulp documentation
| * DOC: Fixed incorrect assert_array_almost_equal_nulp documentationEric O. LEBIGOT (EOL)2014-12-241-1/+1
| | | | | | | | | | | | The `max()` function previously used does not work with two array-like. `maximum()` does, and is what is essentially used in the code (`ref = nulp * np.spacing(np.where(ax > ay, ax, ay))`).
* | MAINT: remove obsolete version checksJulian Taylor2014-10-151-1/+1
| | | | | | | | | | minimum requirement is python2.6, this allows removing a couple 2.3 and 2.4 checks.
* | Merge pull request #5048 from juliantaylor/subclass-test-fixCharles Harris2014-09-041-1/+1
|\ \ | | | | | | BUG: fix array_almost_equal for array subclasses
| * | BUG: fix array_almost_equal for array subclassesJulian Taylor2014-09-051-1/+1
| |/ | | | | | | introduced in gh-4105/ab04e1ae0e8eca717bc7e42f3b0a60c9ff764289
* | BUG: fix percentage reporting when testing.assert_allclose fails.Patrick Peglar2014-08-311-1/+1
| |
* | Merge pull request #4905 from juliantaylor/doc-updateCharles Harris2014-07-271-7/+12
|\ \ | | | | | | documentation updates
| * | DOC: numpy.testing documentation clarification of "Raise an assertion"Austin Godber2014-07-271-7/+12
| |/ | | | | | | | | | | | | | | "Raise an assertion" was changed to "Raises an AssertionError" to clarify that an exception named AssertionError will be raised. Closes gh-4884 [ci skip]
* | Move tempdir context manager to numpy.testing.utilsOlivier Grisel2014-06-301-0/+16
|/
* DOC: fix examples in f2py documentation. They didn't appear at all in html.Ralf Gommers2014-04-211-1/+0
| | | | Also fix example in testing that Sphinx saw as section header.
* Merge pull request #4542 from immerrr/fix-bincount-systemerrorCharles Harris2014-03-261-1/+81
|\ | | | | BUG: fix some errors raised when minlength is incorrect in np.bincount
| * ENH: export nose.tools.assert_raises_regex via numpy.testing.utilsimmerrr2014-03-261-1/+81
| |
* | ENH: Add check for ndarray/scalar in build_err_msgYoshiki Vázquez Baeza2014-03-251-2/+10
| | | | | | | | | | This check is needed now that build_err_msg takes a precision argument, which is only relevant if the things being compared are ndarrays.
* | BUG:change formatting of assert_array_almost_equalYoshiki Vázquez Baeza2014-03-241-10/+10
|/ | | | | | | | assert_array_almost_equal now prints the number of digits that were being compared in the test instead of always printing 8 (the default for array_repr). This would lead to uninformattive error messages. Fixes #2367
* ENH: Explicitly use __eq__ in assert_equal(a,b)Daniel da Silva2014-03-091-1/+3
| | | | Fixes #2552. Changes primary test expression in function.
* DOC: assert_no_warnings versionadded 1.8 -> 1.7alex2014-02-271-1/+1
|
* DOC: some versionadded notesalex2014-02-271-0/+7
|
* BUG: Force allclose logic to use inexact typeSebastian Berg2014-02-161-5/+9
| | | | | | Casting y to an inexact type fixes problems such as abs(MIN_INT) < 0, and generally makes sense since the allclose logic is inherently for float types.
* DEP: Deprecate boolean `-` operationsSebastian Berg2014-02-121-1/+6
| | | | | | | | | | | | Boolean - is not well defined, especially the unary and binary operator are not compatible. In general boolean minus seems to have no real application and does not do what might be expected. All "allclose" type functions (numpy, tests, masked) have to now check for boolean to avoid the deprecation warning. In the future one could think about removing it again and just allowing the upcast.
* ENH: accept callable as message in assert_Julian Taylor2013-10-191-1/+6
| | | | | | | Allows deferring evaluation until failure. Used for blocked minmax test which evaluate array representations for the error message many thousand times accumulating to a full second useless runtime.
* TST: delay error message building to failures in assert_almost_equalJulian Taylor2013-09-241-6/+8
| | | | improves test performance by about 15%
* TST: speed up some very slow testsJulian Taylor2013-09-241-1/+1
| | | | | | | | | Minimize alignment combinations to useful set with SSE, might need to be revisited if we add AVX support. Move large data test_zeros test to slow and drop the extremely slow count_nonzero() call. Rename gen_alignment_data to _gen_alignment_data (private) to reserve right to change it, e.g. add min_size.
* STY: Giant comma spacing fixup.Charles Harris2013-08-181-20/+20
| | | | | | | Run the 2to3 ws_comma fixer on *.py files. Some lines are now too long and will need to be broken at some point. OTOH, some lines were already too long and need to be broken at some point. Now seems as good a time as any to do this with open PRs at a minimum.
* STY: Giant whitespace cleanup.Charles Harris2013-08-181-1/+0
| | | | Now is as good a time as any with open PR's at a low.
* MAINT: remove unused and broken parts of numpy.testingRalf Gommers2013-08-101-3/+11
| | | | Deprecate np.testing.importall - it's pointless and partially broken.
* MAINT: Remove uses of the WarningManager class.Charles Harris2013-07-121-17/+8
| | | | | | | | | | | | WarningManager was a workaround for the lack of the with statement in Python versions < 2.6. As those versions are no longer supported it can be removed. Deprecation notes are added to WarningManager and WarningMessage, but to avoid a cascade of messages in third party apps, no warnings are raised at this time, that can be done later. Closes #3519.