summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test__iotools.py
Commit message (Collapse)AuthorAgeFilesLines
* BUG: genfromtxt gave OverflorError for large integersThomas Robitaille2015-03-061-2/+16
| | | | | | | | | Fix StringConverter to avoid OverflowError in genfromtxt. Before, int(2**66) would work (and return a ‘long’) but then np.array([2**66], dtype=np.integer) would not work and return an OverflowError which would propagate to genfromtxt. This commit fixes this by ensuring testing in advance whether an OverflowError will occur. In addition, this adds an explicit np.int64 entry on systems where integer means int32. Values larger than 2**63-1 will be cast as float. This includes a regression test and adds an entry to the release notes.
* MAINT: Make argument determination in NameValidator more precise.Charles Harris2015-01-231-1/+5
| | | | | | | The function was useing `'u' in case_sensitive` to detect `upper`. Make that more precise with `case_sensitive.startswith('u'). Raise ValueError if case_sensitive has unrecognized value.
* BUG: Closes #2917: numpy.lib._iotools.StringConverter.upgrade returnGarrett-R2014-11-301-7/+11
| | | | numpy.lib._iotools.StringConverter.upgrade should have a return value
* STY: PEP8 compliance for numpy/lib/tests.Charles Harris2014-07-311-1/+1
| | | | | | | The possibly controversial part of this is making the nested array value lists PEP8 compliant, as there is something to be said aligning the values for clarity. In the end, it seemed like the easiest thing to do was to make them PEP8 compliant. The eye can get used to that.
* MAINT: Fix problems noted by pyflakes in numpy/lib/tests.Charles Harris2014-07-311-2/+4
|
* STY: Make numpy/lib/test/*.py PEP8 compliant.Charles Harris2013-09-031-28/+31
| | | | | | | Run autopep8 over the test files in numpy/lib/test and make fixes to the result. Also remove Python5 workaround.
* 2to3: Apply the `numliterals` fixer and skip the `long` fixer.Charles Harris2013-04-131-3/+3
| | | | | | | | | | | | | | | | | | | The numliterals fixer replaces the old style octal number like '01' by '0o1' removes the 'L' suffix. Octal values were previously mistakenly specified in some dates, those uses have been corrected by removing the leading zeros. Simply Removing the 'L' suffix should not be a problem, but in some testing code it looks neccesary, so in those places the Python long constructor is used instead. The 'long' type is no longer defined in Python 3. Because we need to have it defined for Python 2 it is added to numpy/compat/np3k.py where it is defined as 'int' for Python 3 and 'long' for Python 2. The `long` fixer then needs to be skipped so that it doesn't undo the good work. Closes #3074, #3067.
* 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: Apply `imports` fixer.Charles Harris2013-04-021-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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: 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/+2
| | | | assert in non-testing files that should be checked for correctness.
* BUG: ticket #1428, allow int64 and uint64 integer types to be specified inCharles Harris2011-04-021-0/+16
| | | | genfromtxt.
* * fixed 'flatten_dtype' to support fields w/ titles (bug #1591). Thx to ↵pierregm2010-09-131-11/+33
| | | | | | Stefan vdW for the fix. * added a unittest for flatten_dtype
* 3K: lib: more str vs bytes issues in the lib/io loadtxt, savetxt and genfromtxtPauli Virtanen2010-02-201-13/+14
|
* 3K: lib: fix some bytes vs. str issues in _iotools.py and io.py -- mainly ↵Pauli Virtanen2010-02-201-50/+65
| | | | genfromtxt
* Hard tab removal.Charles Harris2009-10-201-5/+5
| | | | | Trailing whitespace removal. Some coding style cleanups.
* * _iotools.StringConverterpierregm2009-10-141-1/+10
| | | | | | | | | | - prevents a `default` of 0 to be overwritten during initialization - allows the `missing_values` to be a comma-separated string * io.genfromtxt - `usecols` can now be a single integer - for `usecols` and `names` to list (for compatibility w/ Python 2.5) - negative values in `usecols` are properly transformed to positive integers - fixed `usecols` with named columns
* * _iotools.StringConverterpierregm2009-10-121-0/+12
| | | | | | | | | | - prevents an explicit default to be overwritten during upgrade * io.genfromtxt - deprecate `skiprows` for `skip_header` - deprecate `missing` for `missing_values` - `missing_values` can now be a sequence - add support for `filling_values` * fixed ticket #1257
* * ma.masked_equal : force the `fill_value` of the output to `value` (ticket ↵pierregm2009-10-091-1/+86
| | | | | | | | | | | | | #1253) * lib._iotools: - NameValidator : add the `nbfields` optional argument to validate - add easy_dtype * lib.io.genfromtxt : - add the `autostrip` optional argument (ticket #1238) - use `invalid_raise=True` as default - use the easy_dtype mechanism (ticket #1252)
* * genfromtxt : fixed case when using explicit converters and explicit dtype.pierregm2009-02-141-0/+8
|
* * genfromtxt : Fixed when a dtype involving objects is explicitly given. ↵pierregm2009-02-051-1/+16
| | | | | | Raise a NotImplementedError if the dtype is nested. * _iotools : make sure StringConverter gets properly initiated when a function returning a np.object is used as input parameter.
* test_upgrademapper : got rid of the dateutil importpierregm2009-02-041-10/+11
|
* * test__iotools : prevent test_upgrademapper if dateutil is not installedpierregm2009-02-041-7/+10
| | | | * MaskedArray.__rmul__ : switch to multiply(self, other)
* * lib : introduced _iotoolspierregm2009-01-191-0/+140
* lib.io : introduced genfromtxt, ndfromtxt, mafromtxt, recfromtxt, recfromcsv.