summaryrefslogtreecommitdiff
path: root/numpy/testing/utils.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge pull request #3191 from charris/2to3-apply-imports-fixerCharles Harris2013-04-061-2/+6
|\ | | | | 2to3: Apply `imports` fixer.
| * 2to3: Apply `imports` fixer.Charles Harris2013-04-021-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `imports` fixer deals with the standard packages that have been renamed, removed, or methods that have moved. cPickle -- removed, use pickle commands -- removed, getoutput, getstatusoutput moved to subprocess urlparse -- removed, urlparse moved to urllib.parse cStringIO -- removed, use StringIO or io.StringIO copy_reg -- renamed copyreg _winreg -- renamed winreg ConfigParser -- renamed configparser __builtin__ -- renamed builtins In the case of `cPickle`, it is imported as `pickle` when python < 3 and performance may be a consideration, but otherwise plain old `pickle` is used. Dealing with `StringIO` is a bit tricky. There is an `io.StringIO` function in the `io` module, available since Python 2.6, but it expects unicode whereas `StringIO.StringIO` expects ascii. The Python 3 equivalent is then `io.BytesIO`. What I have done here is used BytesIO for anything that is emulating a file for testing purposes. That is more explicit than using a redefined StringIO as was done before we dropped support for Python 2.4 and 2.5. Closes #3180.
* | Merge pull request #460 from endolith/regex_formattingCharles Harris2013-04-031-1/+1
|\ \ | |/ |/| DOC: Formatting fixes using regex
| * DOC: Used regex to find colons missing spaces which render wrong online, ↵endolith2013-03-191-1/+1
| | | | | | | | also other spacing or formatting mistakes
* | 2to3: Use absolute imports.Charles Harris2013-03-281-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: 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.
* Merge pull request #3056 from charris/2to3-filterCharles Harris2013-03-011-1/+1
|\ | | | | 2to3: Apply `filter` fixes. Closes #3053.
| * REF: Replace filters with list comprehensions.Charles Harris2013-02-281-1/+1
| | | | | | | | | | | | 2to3 does a lot of list(filter(...)) sort of thing which can be avoided by using list comprehensions instead of filters. This also seems to clarify the code to a considerable degree.
| * 2to3: Apply `filter` fixes. Closes #3053.Charles Harris2013-02-281-1/+1
| | | | | | | | | | Generally, this involves using list comprehension, or explicit list construction as `filter` is an iterator in Python 3.
* | 2to3: apply exec fixer results.Charles Harris2013-02-281-2/+2
|/ | | | This changes the `exec` command to the `exec` function.
* 2to3: Use modern exception syntax.Charles Harris2013-02-261-1/+1
| | | | Example: except ValueError,msg: -> except ValueError as msg:
* ENH: More capable test functions for warningsNathaniel J. Smith2012-09-201-3/+37
| | | | | | | 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.
* Remove maskna API from ndarray, and all (and only) the code supporting itNathaniel J. Smith2012-06-161-37/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original masked-NA-NEP branch contained a large number of changes in addition to the core NA support. For example: - ufunc.__call__ support for where= argument - nditer support for arbitrary masks (in support of where=) - ufunc.reduce support for simultaneous reduction over multiple axes - a new "array assignment API" - ndarray.diagonal() returning a view in all cases - bug-fixes in __array_priority__ handling - datetime test changes etc. There's no consensus yet on what should be done with the maskna-related part of this branch, but the rest is generally useful and uncontroversial, so the goal of this branch is to identify exactly which code changes are involved in maskna support. The basic strategy used to create this patch was: - Remove the new masking-related fields from ndarray, so no arrays are masked - Go through and remove all the code that this makes dead/inaccessible/irrelevant, in a largely mechanical fashion. So for example, if I saw 'if (PyArray_HASMASK(a)) { ... }' then that whole block was obviously just dead code if no arrays have masks, and I removed it. Likewise for function arguments like skipna that are useless if there aren't any NAs to skip. This changed the signature of a number of functions that were newly exposed in the numpy public API. I've removed all such functions from the public API, since releasing them with the NA-less signature in 1.7 would create pointless compatibility hassles later if and when we add back the NA-related functionality. Most such functions are removed by this commit; the exception is PyArray_ReduceWrapper, which requires more extensive surgery, and will be handled in followup commits. I also removed the new ndarray.setasflat method. Reason: a comment noted that the only reason this was added was to allow easier testing of one branch of PyArray_CopyAsFlat. That branch is now the main branch, so that isn't an issue. Nonetheless this function is arguably useful, so perhaps it should have remained, but I judged that since numpy's API is already hairier than we would like, it's not a good idea to add extra hair "just in case". (Also AFAICT the test for this method in test_maskna was actually incorrect, as noted here: https://github.com/njsmith/numpyNEP/blob/master/numpyNEP.py so I'm not confident that it ever worked in master, though I haven't had a chance to follow-up on this.) I also removed numpy.count_reduce_items, since without skipna it became trivial. I believe that these are the only exceptions to the "remove dead code" strategy.
* ENH: missingdata: Finish count_nonzero as a full-fledged reduction operationMark Wiebe2011-08-271-16/+60
|
* ENH: missingdata: Fix remaining issues in scalar -> array assignment functionMark Wiebe2011-08-271-1/+4
|
* Changed to follow PEP 7Chris Jordan-Squire2011-08-221-1/+1
|
* DOCS: New ufunc creation docsChris Jordan-Squire2011-08-221-1/+1
|
* ENH: skip doctests for testsMatthew Brett2011-08-161-3/+2
| | | | | | | | | | | | There are various docstrings show examples of how to run the tests, and give example test output. Obviously the test output changes, and running the doctests for the testing package: import numpy.testing as npt npt.test(doctests=True) will cause several large sets of tests to be run in the rest of the tree. So I skipped these.
* STY: Replace assert by assert_ in tests. There remain 124 uses ofCharles Harris2011-04-051-4/+3
| | | | assert in non-testing files that should be checked for correctness.
* STY: Replace remaining old style classes with classes subclassing object.Charles Harris2011-04-051-1/+1
|
* BUG: fix assert_almost_equal and co. to work with infs.rgommers2011-03-121-17/+26
|
* BUG: did not intend to change default tolerances in assert_allclose. Revert.rgommers2011-03-091-1/+1
|
* DOC: Update the docs for numpy.testing - prefer allclose and nulp funcs. ↵rgommers2011-03-091-78/+106
| | | | Closes #1543.
* BUG: Fix exception syntax to conform to python 2.4.Charles Harris2011-02-011-1/+1
|
* BUG: core: Fix things so scipy trunk passes all tests (but one)Mark Wiebe2011-01-271-3/+4
| | | | | | | With this patch, the latest scipy trunk (7087), built against NumPy 1.5.1, passes all tests when run against the numpy trunk. The single failing test, test_imresize, fails because it tests all float types, and the new 'half' type lacks the precision to pass that test.
* ENH: testing: add assert_tol_equal for testing array equality with specified ↵Pauli Virtanen2010-07-281-1/+37
| | | | tolerances
* BUG: Ignore "invalid value" from abs in testing/utils.pyCharles Harris2010-02-211-2/+7
|
* BUG: More workarounds for np.isinf warning in tests.Charles Harris2010-02-211-8/+16
|
* more docstring updates from pydoc website (thanks to everyone who contributed!)Jarrod Millman2010-02-171-17/+99
|
* ENH: handle complex input for assert_array_almost_equal_nulp.David Cournapeau2010-02-091-3/+6
|
* BUG: fix typo.David Cournapeau2010-02-091-1/+1
|
* fixed a whole bunch of doctestsPaul Ivanov2009-12-281-0/+1
|
* BUG: make assert_equal and assert_almost_equal always display err_msgPauli Virtanen2009-12-071-8/+5
|
* Fix tests now that ufuncs raise NotImplementedError.Travis Oliphant2009-12-041-6/+4
|
* ENH: add an assert_warns testing utility.David Cournapeau2009-11-231-1/+25
|
* REF: move warning context manager into utils.David Cournapeau2009-11-231-0/+85
|
* BUG: use %g format in assert_array_*_nulp (fix #1297, thanks to Neil Muller)Pauli Virtanen2009-11-131-2/+2
|
* ENH: remove any mention of original python spacing, use ufunc everywhere.David Cournapeau2009-11-101-33/+2
|
* BUG: wrong exception raised in spacing for incompatible dtype.David Cournapeau2009-10-301-2/+0
|
* STY: remove whitespace.David Cournapeau2009-10-301-3/+3
|
* ENH: add assert_array_max_ulp comparison function.David Cournapeau2009-10-301-1/+12
| | | | | 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-1/+80
| | | | | | 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/+33
|
* ENH: add a function to compute the signed-magnitude interpretation of the ↵David Cournapeau2009-10-301-0/+24
| | | | binary repr of a float.
* Don't include assert_valid_refcount in numpy.testing.*Pauli Virtanen2009-10-101-2/+6
| | | | It's a private function used only in two internal regression tests.
* Docstring update: testingPauli Virtanen2009-10-021-13/+128
|
* BUG: fix list/tuple handling in test_almost_equal.David Cournapeau2009-09-211-1/+2
| | | | We now forward tuple/list instances to test_array_almost_equal.
* All non core regressions tests moved to their respective modules.David Cournapeau2009-09-161-1/+16
|
* Import issubdtype from numpy.core directly so that testing.utils does not ↵David Cournapeau2009-09-161-3/+4
| | | | depend on numpy.lib.
* Hmm, somehow a reference to math.fabs slipped by and didn't show here. TryCharles Harris2009-08-031-1/+1
| | | | again.