summaryrefslogtreecommitdiff
path: root/numpy/testing
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
| |
* | 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.
* | 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.
* | TST: Add tests for build_err_msgYoshiki Vázquez Baeza2014-03-241-0/+43
| |
* | 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-162-5/+17
| | | | | | 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.
* BUG: testing.run_module_suite() didn't pass on KnownFailure.Ralf Gommers2014-01-181-6/+9
| | | | | | This results in errors whenever you run tests using KnownFailure like so: ``python test_mymodule.py`` (where run_module_suite is used in the file, like numpy and scipy do).
* STY: Style adjustments to run_module_suite.Pascal Bugnion2014-01-151-1/+3
| | | | | Cosmetic adjustments to previous commit (893fe99) following "charris"'s comments.
* DOC: Added docstring for run_module_suite.Pascal Bugnion2014-01-151-0/+32
|
* ENH: Added argv argument to run_module_suite.Pascal Bugnion2014-01-151-2/+6
| | | | | | | | | | | | | | | Adding an 'argv' optional argument to the "numpy.testing.run_module_suite" function lets the client pass arguments to the nose testrunner. For example, this lets the user add things like: run_module_suite(sys.argv) at the end of a test module, so that arguments specified on the command line will get passed to the nose runner. The user could then run: $ python test_module.py --nocapture
* 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-189-37/+37
| | | | | | | 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-183-3/+1
| | | | Now is as good a time as any with open PR's at a low.
* MAINT: Refactor nanfunctions.Charles Harris2013-08-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nanmax, nanmin -------------- Add out and keepdims keywords. nanargmin, nanargmax -------------------- A NanWarning is raised if an all NaN slice detected. For all such slices np.iingo(np.intp).min is returned as the index value. nansum ------ The keywords dtype, out, and keepdims are added. A FutureWarning is raised, as in the future the mean of an empty slice after NaN replacement will be 0 instead of the current NaN. nanmean, nanvar, nanstd ----------------------- For all, if the input array is of inexact type then the dtype and out parameters must be of inexact type if specified. That insures that NaNs can be returned when appropriate. The nanmean function detects empty slices after NaN replacement and raises a NanWarning. NaN is returned as the value for all such slices. The nanmean and nanstd functions detect degrees of freedom <= 0 after NaN replacement and raise a NanWarning. NaN is returned as the value for all such slices.
* MAINT: remove unused and broken parts of numpy.testingRalf Gommers2013-08-106-47/+21
| | | | Deprecate np.testing.importall - it's pointless and partially broken.
* MAINT: Remove uses of the WarningManager class.Charles Harris2013-07-123-50/+29
| | | | | | | | | | | | 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.
* MAINT: Use np.errstate context manager.Charles Harris2013-07-111-15/+5
| | | | | | | | | | | | | Now that Python < 2.6 is no longer supported we can use the errstate context manager in places where constructs like ``` old = seterr(invalid='ignore') try: blah finally: seterr(**old) ``` were used.
* DEP: Deprecate the oldnumeric and numarray modules.Charles Harris2013-06-102-0/+4
| | | | | | | | | The numarray and oldnumeric modules are deprecated. This is a bit tricky as raising a DeprecationWarning on import causes an error when tests are run. To deal with that, a ModuleDeprecationWarning class is added to numpy and NoseTester is modified to ignore that warning during testing. Closes #2905
* MAINT: fix shape mismatch issue in alignment data generatorJulian Taylor2013-06-081-4/+4
|
* ENH: vectorize sqrt ufunc using SSE2Julian Taylor2013-05-251-0/+67
| | | | | | | | | | | | | | | | | | specialize the sqrt ufunc for float and double and vectorize it using SSE2. improves performance by 4/2 for float/double if one is not memory bound due to non-cached data. performance is always better on all tested machines (amd phenom X2, intel xeon 5xxx/7xxx, core2duo, corei7) This version will not set errno on invalid input, but numpy only checks the fpu flags so the behavior is the same. In principle the compiler could autovectorize it when setting ffast-math (for no errno) and specializing the loop for the vectorizable strides and giving it some hints (restrict, __builtin_assume_aligned, etc.), but its simpler and more reliable to simply vectorize it by hand.
* BUG: testing: always enable --exePauli Virtanen2013-05-091-0/+8
| | | | | | Setuptools tends to set +x to the installed test scripts, which makes numpy.test() to not run any tests. Having --exe always enabled is not problematic because only files matching 'test_*.py' are looked into.
* 2to3: Apply types fixer.Charles Harris2013-04-141-4/+3
| | | | | | | | | | | | | | | | | | | | Python 3 removes the builtin types from the types module. The types fixer replaces such references with the builtin types where possible and also takes care of some special cases: types.TypeNone <- type(None) types.NotImplementedType <- type(NotImplemented) types.EllipsisType <- type(Ellipsis) The only two tricky substitutions are types.StringType <- bytes types.LongType <- int These are fixed up to support both Python 3 and Python 2 code by importing the long and bytes types from numpy.compat. Closes #3240.
* Merge pull request #3237 from charris/2to3-apply-basestringCharles Harris2013-04-141-0/+1
|\ | | | | 2to3: Apply basestring fixer.
| * 2to3: Apply basestring fixer.Charles Harris2013-04-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | The basestring class is not defined in Python 3 and the fixer replaces it with str. In order to have a common code base we define basestring in numpy/compat/py3k.py to be str when the Python version is >= 3, otherwise basestring and import it where needed. That works for most cases, but there are a few files where the version dependent define needs to be in the file. Closes #3042.
* | ENH: testing: remove an annoying line feed from skipif decoratorPauli Virtanen2013-04-131-2/+2
|/ | | | | The line feed is annoying as it makes Nose's verbose test output not print one line per one test.
* 2to3: Apply `map` fixer.Charles Harris2013-04-101-1/+2
| | | | | | | | | | | | | | | | | | | In Python 3 `map` is an iterator while in Python 2 it returns a list. The simple fix applied by the fixer is to inclose all instances of map with `list(...)`. This is not needed in all cases, and even where appropriate list comprehensions may be preferred for their clarity. Consequently, this patch attempts to use list comprehensions where it makes sense. When the mapped function has two arguments there is another problem that can arise. In Python 3 map stops execution when the shortest argument list is exhausted, while in Python 2 it stops when the longest argument list is exhausted. Consequently the two argument case might need special care. However, we have been running Python3 converted versions of numpy since 1.5 without problems, so it is probably not something that affects us. Closes #3068
* 2to3: Apply `repr` fixer.Charles Harris2013-04-081-4/+4
| | | | | | | | | | | | This replaces python backtics with repr(...). The backtics were mostly used to generate strings for printing with a string format and it is tempting to replace `'%s' % repr(x)` with `'%r' % x`. That would work except where `x` happened to be a tuple or a dictionary but, because it would be significant work to guarantee that and because there are not many places where backtics are used, the safe path is to let the repr replacements stand. Closes #3083.
* 2to3: Apply `print` fixer.Charles Harris2013-04-0612-47/+47
| | | | | | | Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.
* 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-2811-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-272-5/+5
|/ | | | | | | | | | | | | | | 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
* Merge pull request #3026 from charris/2to3-fix-printCharles Harris2013-03-0112-3/+28
|\ | | | | 2to3: Put `from __future__ import division` in every python file.
| * 2to3: Put `from __future__ import division in every python file.Charles Harris2013-03-0112-3/+28
| | | | | | | | | | | | | | | | 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 #3099 from charris/2to3-methodattrsnjsmith2013-03-011-2/+2
|\ \ | |/ |/| 2to3: Apply `methodattrs` fixes.
| * 2to3: Apply `methodattrs` fixes.Charles Harris2013-03-011-2/+2
| | | | | | | | | | Replaces old style `f.im_func` and `f.im_class` method attributes with `f.__func__` and `f.__class__`. Closes #3070.
* | 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.