summaryrefslogtreecommitdiff
path: root/numpy/testing/tests/test_utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #7042 from charris/revert-7001Charles Harris2016-01-161-31/+2
|\ | | | | Revert "Merge pull request #7001 from shoyer/NaT-comparison"
| * Revert "Merge pull request #7001 from shoyer/NaT-comparison"Charles Harris2016-01-161-31/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | TST: Make assert_warns an optional contextmanagerStephan Hoyer2016-01-141-0/+15
|/
* TST, ENH: make all comparisons with NaT falseStephan Hoyer2016-01-141-2/+31
| | | | | | | | | 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
* MAINT: Use temppath in test_not_closing_opened_fid.Charles Harris2015-12-201-2/+6
| | | | | The test is in numpy/lib/tests/test_io.py. This commit is intended as a demonstration of using temppath.
* ENH: Add context manager `temppath` to manage a temporary file.Charles Harris2015-12-191-1/+32
| | | | | | | | | | | | 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`.
* BUG: testing: fix a bug in assert_string_equalPauli Virtanen2015-11-141-1/+18
|
* MAINT: pyflakes for numpy/testing, numpy/testing/tests.Charles Harris2015-07-051-5/+27
|
* STY: PEP8 fixes for numpy/testing numpy/testing/tests.Charles Harris2015-07-051-15/+14
|
* ENH: add clear_and_catch_warnings context managerMatthew Brett2015-03-141-1/+69
| | | | | | | 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.
* TST: Update assert_array_almost_equal_nulp testsRyan Nelson2015-01-111-39/+164
| | | | | | | | | | | | | | | | 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.
* Merge pull request #5048 from juliantaylor/subclass-test-fixCharles Harris2014-09-041-0/+8
|\ | | | | BUG: fix array_almost_equal for array subclasses
| * BUG: fix array_almost_equal for array subclassesJulian Taylor2014-09-051-0/+8
| | | | | | | | introduced in gh-4105/ab04e1ae0e8eca717bc7e42f3b0a60c9ff764289
* | Use more portable test methods.Patrick Peglar2014-09-021-1/+5
| |
* | BUG: fix percentage reporting when testing.assert_allclose fails.Patrick Peglar2014-08-311-0/+5
|/
* TST: Change tests to look at array formatting onlyYoshiki Vázquez Baeza2014-03-251-7/+9
| | | | | | The tests were looking at the formatting of other elements in the string which is not relevant for the things testsed in this case. By looking only at the array formatting, we guarantee consistency across systems.
* TST: Remove test that makes no senseYoshiki Vázquez Baeza2014-03-251-12/+0
| | | | | It's silly to check scalars when their string representations will vary so much from system to system.
* BUG: Fix non-compatible py3 propertyYoshiki Vázquez Baeza2014-03-251-3/+3
|
* TST: Add exception message formatting testsYoshiki Vázquez Baeza2014-03-251-0/+35
| | | | | | assert_approx_equal & assert_almost_equal make internal use of build_err_msg so a few tests have been added to check that the errors are formatted correctly.
* TST: Add tests for build_err_msgYoshiki Vázquez Baeza2014-03-241-0/+43
|
* BUG: Force allclose logic to use inexact typeSebastian Berg2014-02-161-0/+8
| | | | | | 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.
* STY: Giant comma spacing fixup.Charles Harris2013-08-181-1/+1
| | | | | | | 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.
* 2to3: Apply `print` fixer.Charles Harris2013-04-061-1/+1
| | | | | | | Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.
* 2to3: Use absolute imports.Charles Harris2013-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new import `absolute_import` is added the `from __future__ import` statement and The 2to3 `import` fixer is run to make the imports compatible. There are several things that need to be dealt with to make this work. 1) Files meant to be run as scripts run in a different environment than files imported as part of a package, and so changes to those files need to be skipped. The affected script files are: * all setup.py files * numpy/core/code_generators/generate_umath.py * numpy/core/code_generators/generate_numpy_api.py * numpy/core/code_generators/generate_ufunc_api.py 2) Some imported modules are not available as they are created during the build process and consequently 2to3 is unable to handle them correctly. Files that import those modules need a bit of extra work. The affected files are: * core/__init__.py, * core/numeric.py, * core/_internal.py, * core/arrayprint.py, * core/fromnumeric.py, * numpy/__init__.py, * lib/npyio.py, * lib/function_base.py, * fft/fftpack.py, * random/__init__.py Closes #3172
* 2to3: Replace xrange by range and use list(range(...)) where neededCharles Harris2013-03-271-1/+1
| | | | | | | | | | | | | | | In python3 range is an iterator and `xrange` has been removed. This has two consequence for code: 1) Where a list is needed `list(range(...))` must be used. 2) `xrange` must be replaced by `range` Both of these changes also work in python2 and this patch makes both. There are three places fixed that do not need it, but I left them in so that the result would be `xrange` clean. Closes #3092
* 2to3: Put `from __future__ import division in every python file.Charles Harris2013-03-011-0/+2
| | | | | | | | This should be harmless, as we already are division clean. However, placement of this import takes some care. In the future a script can be used to append new features without worry, at least until such time as it exceeds a single line. Having that ability will make it easier to deal with absolute imports and printing updates.
* ENH: More capable test functions for warningsNathaniel J. Smith2012-09-201-1/+5
| | | | | | | 1) New function assert_no_warnings 2) Make assert_warns and assert_no_warnings pass through the function's return value on success, so that it can be checked as well.
* [FIX] Make np.random.shuffle less brain-deadNathaniel J. Smith2012-07-171-4/+7
| | | | | | | | | The logic in np.random.shuffle was... not very sensible. Fixes trac ticket #2074. This patch also exposes a completely unrelated issue in numpy.testing. Filed as Github issue #347 and marked as knownfail for now.
* BUG: fix assert_almost_equal and co. to work with infs.rgommers2011-03-121-0/+9
|
* ENH: ufunc: Make many more tests pass with the new ufunc codeMark Wiebe2011-01-211-1/+1
|
* ENH: testing: add assert_tol_equal for testing array equality with specified ↵Pauli Virtanen2010-07-281-0/+23
| | | | tolerances
* DEP: Fix deprecation warnings in Python 3.1. The warnings come from the unittestCharles Harris2010-02-201-23/+23
| | | | | | | | | module. The fix should be good for Python >= 2.4 and used the following sed script: s/\<failUnless\>/assertTrue/g s/\<failIf\>/assertFalse/g s/\<failUnlessEqual\>/assertEqual/g s/\<failUnlessRaises\>/assertRaises/g
* TST: add simple test for complex arrays input to assert_array_almost_equal_nulp.David Cournapeau2010-02-091-0/+13
|
* BUG: fix 2.5 >= try/except/finally.David Cournapeau2009-11-231-5/+6
|
* ENH: add an assert_warns testing utility.David Cournapeau2009-11-231-0/+34
|
* REF: move spacing tests to umath as spacing is now a ufunc.David Cournapeau2009-11-101-39/+0
|
* ENH: add assert_array_max_ulp comparison function.David Cournapeau2009-10-301-0/+53
| | | | | This new comparison raises an error if the number of representable numbers between two arrays exceeds a tolerance.
* ENH: add robust comparison function for floating numbers.David Cournapeau2009-10-301-0/+27
| | | | | | assert_array_almost_equal_nulp use spacing so that a single tolerance number can be used independently on the amplitude of the floating point number.
* ENH: add numpy implementation of F90 spacing function.David Cournapeau2009-10-301-0/+38
|
* BUG: handle inf/nan correctly in assert_array_almost_equal.David Cournapeau2009-07-281-0/+1
|
* BUG: fix nan/inf handling for complex dtypes.David Cournapeau2009-07-281-0/+15
|
* Handle complex special values and negative zero.David Cournapeau2009-07-271-0/+16
| | | | | Complex with nan/inf are correctly handled in assert_equal, as well as negative zero.
* Handle nan and inf in assert_equal.David Cournapeau2009-07-271-1/+19
|
* BUG: handle nan/inf in assert_approx_equal.David Cournapeau2009-07-271-0/+56
|
* BUG: assert_array_compare did not raise an exception when the nan indexes of ↵David Cournapeau2009-07-271-0/+12
| | | | both arguments did not match.
* Handle nan and inf in assert_almost_equal.David Cournapeau2009-07-271-1/+20
|
* Fixed #745: make assert_array_almost_equal work with object arraysPauli Virtanen2009-03-091-0/+5
|
* Small cleanup.Charles Harris2008-08-291-3/+1
|
* Standardize NumPy import as "import numpy as np".Alan McIntyre2008-07-221-19/+19
|
* Restore old test framework classes.Alan McIntyre2008-06-211-1/+1
| | | | | | | | | | | Added numpy.testing.run_module_suite to simplify "if __name__ == '__main__'" boilerplate code in test modules. Removed numpy/testing/pkgtester.py since it just consisted of an import statement after porting SciPy r4424. Allow numpy.*.test() to accept the old keyword arguments (but issue a deprecation warning when old arguments are seen). numpy.*.test() returns a test result object as before. Fixed typo in distutils doc.