summaryrefslogtreecommitdiff
path: root/numpy/ma/testutils.py
Commit message (Collapse)AuthorAgeFilesLines
* DEP: deprecate `product`, `cumproduct`, `sometrue`, `alltrue`Ralf Gommers2023-03-021-1/+1
| | | | [skip cirrus]
* ENH: Use new argument parsing for array creation functionsSebastian Berg2021-03-181-2/+2
| | | | | | | | | | | | | | | | | | The array creation functions have the most to gain: 1. np.asarray is 4 times faster and commonly used. 2. Other functions are wrapped using __array_function__ in Python making it more difficult This commit (unfortunatly) has to do a few things: * Modify __array_function__ C-side dispatching to accomodate the fastcall argument convention. * Move asarray, etc. to C after removing all "fast paths" from np.array (simplifying the code) * Fixup imports, since asarray was imported directly in a few places * Replace some places where `np.array` was probably used for speed instead of np.asarray or similar. (or by accident in 1 or 2 places)
* MAINT: Conversion of some strings to fstrings, part III (#17623)jakobjakobson132020-10-251-5/+5
| | | | | | | | | | | | | | | | | | | | * Conversion of some strings to fstrings * Remove spaces * Update numpy/ma/mrecords.py Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> * Update numpy/ma/tests/test_old_ma.py Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> * Update numpy/ma/timer_comparison.py Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com> Co-authored-by: Jakob <jakobjakobson13@posteo.de> Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com>
* 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.
* MAINT: Remove all uses of run_module_suite.Charles Harris2018-04-061-3/+3
| | | | | That function is nose specific and has not worked since `__init__` files were added to the tests directories.
* MAINT: Remove use of unittest in NumPy tests.xoviat2018-03-211-1/+2
| | | | | | | | | | | | | | | | This removes a few left over uses of unittest. The main changes apart from removal of Test case are: * `setUp` replaced by nose and pytest compatible `setup` * `tearDown` replaced by nose and pytest compatible `teardown` * `assertRaises` replaced by `assert_raises` * `assertEqual` replaced by `assert_equal` The last two are in `numpy/testings/tests/test_utils.py`, so may seem a but circular, but at least are limited to those two functions. The use of `setup` and `teardown`, can be fixed up with the pytest equivalents after we have switched to pytest.
* MAINT: Rearrange files in numpy/testing module.Charles Harris2017-07-041-6/+6
| | | | | | | | | | | | | | | | | The aim here is to separate out the nose dependent files prior to adding pytest support. This could be done by adding new files to the general numpy/testing directory, but I felt that it was to have the relevant files separated out as it makes it easier to completely remove nose dependencies when needed. Many places were accessing submodules in numpy/testing directly, and in some cases incorrectly. That presented a backwards compatibility problem. The solution adapted here is to have "dummy" files whose contents will depend on whether of not pytest is active. That way the module looks the same as before from the outside. In the case of numpy itself, direct accesses have been fixed. Having proper `__all__` lists in the submodules helped in that.
* BUG: Remove warning NaT filter from masked array test utilsSebastian Berg2017-05-071-5/+3
| | | | | | | | | | This may show warnings in downstream projects, which should likely not be there. We could also drop in the normal assert_equal there, which would support NaT, and NaN, but checks for scalarness, which this currently does not (which also could create problems). Works around the only test with this problem, by using the normal assert_equal there.
* BUG: Suppress common NaT warningsSebastian Berg2016-09-021-3/+5
| | | | | | | | | Printing of datetime arrays used to cause warning due to comparison warnings in NaT. This is circumvented by using views to integer values. Part of this should be simplified when the deprecation is over. Also fixes a bug with non-native byteorder.
* Revert "Merge pull request #7001 from shoyer/NaT-comparison"Charles Harris2016-01-161-1/+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.
* TST, ENH: make all comparisons with NaT falseStephan Hoyer2016-01-141-4/+1
| | | | | | | | | 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: Continue to export some testing functions from ma.testutils.Charles Harris2015-07-251-7/+10
| | | | | This is for backward compatibility. We may want to add more testing functions if other folks run into problems in the 1.10 release.
* STY,MAINT: Run pyflakes and pep8 on numpy/ma/tests/*.Charles Harris2015-07-251-1/+13
| | | | | | | | Also fix "*" imports. The formatting of test arrays is not fixed for multiple spaces following "," and other violations that are common in tests. To be precise, E241 and E201 are added to the errors that are excluded.
* STY,MAINT: PEP8 and pyflakes fixes for numpy/ma/*.pyCharles Harris2015-07-041-52/+86
| | | | | | | | | | Also * Add __all__ to numpy/ma/testutils.py * Remove various stray "#" We might want to consider removing/refactoring both numpy/ma/bench.py and numpy/ma/timer_comparison.
* 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-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/+3
| | | | | | | | 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.
* STY: Replace assert by assert_ in tests. There remain 124 uses ofCharles Harris2011-04-051-2/+3
| | | | assert in non-testing files that should be checked for correctness.
* WRN: iter: Fix half-float warnings, other small tweaksMark Wiebe2011-01-271-4/+1
|
* ENH: core: Replace PyArray_CastTo with a call to PyArray_CopyIntoMark Wiebe2011-01-171-3/+5
| | | | | | | | | Since CopyInto uses the dtype transfer mechanism to do the copying, this also fully handles casting. This also exposed a byte order issue in the dtype transfer code of converting to object arrays. The switch from position-based structure copying to name-based copying required a small change to a masked array test as well.
* (no commit message)pierregm2010-08-091-27/+27
|
* Cleanup r7978 (add err_msg support to assert_mask_equalmdroe2009-12-071-2/+2
|
* testutils:pierregm2008-12-231-13/+14
| | | | | | | | | | | | | * assert_equal : use assert_equal_array on records * assert_array_compare : prevent the common mask to be back-propagated to the initial input arrays. * assert_equal_array : use operator.__eq__ instead of ma.equal * assert_equal_less: use operator.__less__ instead of ma.less core: * Fixed _check_fill_value for nested flexible types * Add a ndtype option to _make_mask_descr * Fixed mask_or for nested flexible types * Fixed the printing of masked arrays w/ flexible types.
* testutils:pierregm2008-12-221-7/+9
| | | | | | assert_array_compare : make sure that the comparison is performed on ndarrays, and make sure we use the np version of the comparison function. core: * Try not to touch the data in unary/binary ufuncs, (including inplace)
* use if ...: raise AssertionError instead of assertpierregm2008-09-291-7/+14
|
* Removed unused imports.Alan McIntyre2008-09-131-4/+2
| | | | Standardize NumPy import as "import numpy as np".
* ran reindentJarrod Millman2008-08-081-6/+6
|
* testutilspierregm2008-07-171-1/+10
| | | | | | | | | | | * improved check on object/record arrays core * fixed filled for flexible types * fixed the definition of the mask for flexible types mrecords: * fixed a bug w/ titles/formats in __new__ and __array_finalize__
* prevent .reshape to update the whole __dict__ of the result, use ↵pierregm2008-07-011-1/+1
| | | | ._update_from instead
* Switched to use nose to run tests. Added test and bench functions to all ↵Alan McIntyre2008-06-171-5/+5
| | | | modules.
* core:pierregm2008-06-031-94/+69
| | | | | | | | | | | | | | | | | | | | | | | | | * use the "import numpy as np" convention * use np.function instead of (from)numeric.function * CHANGE : when using named fields, the fill_value is now a void-ndarray (and no longer a tuple) * _check_fill_value now checks that an existing fill_value is compatible with a new dtype (bug #806) * fix_invalid now accepts the mask keyword * MaskedArray.__new__ doesn't run _check_fill_value when the fill_value is None * add the astype method, to support the conversion of fill_value when needed. * arange/empty/empty_like/ones/zeros are now available through _convert2ma test_core: * modified test_filled_value to reflect that fill_value is a void-ndrecord when using named fields * added test_check_fill_value/test_check_fill_value_with_records testutils: * use the "import numpy as np" convention * assert_equal_records now uses getitem instead of getattr * assert_array_compare now calls numpy.testing.utils.assert_array_compare on filled data * the assert_xxx functions now accept the verbose keyword mrecords: * MaskedRecords inherit get_fill_value and set_fill_value from MaskedArray * In filled, force the filling value to be a void-ndarray
* fixed whitespace w/ reindentJarrod Millman2008-05-221-1/+1
|
* core : fixed a bug w/ array((0,0))/0.pierregm2008-04-301-1/+27
| | | | | | testutils : introduced assert_almost_equal/assert_approx_equal: use assert_almost_equal(a,b,decimal) to compare a and b up to decimal places use assert_approx_equal(a,b,decimal) to compare a and b up to b*10.**-decimal
* ran reindent in preparation for the 1.1 releaseJarrod Millman2008-04-201-1/+1
|
* Fix benchmarks. Remove remaining imports of maskedarray.Stefan van der Walt2007-12-151-2/+1
|
* Move ma to numpy root. Fix unit tests. Remove references to numpy.core.ma.Stefan van der Walt2007-12-151-0/+220