diff options
| -rw-r--r-- | doc/sphinxext/numpydoc/docscrape_sphinx.py | 2 | ||||
| -rw-r--r-- | doc/sphinxext/numpydoc/numpydoc.py | 1 | ||||
| -rw-r--r-- | doc/sphinxext/numpydoc/tests/test_docscrape.py | 13 | ||||
| -rw-r--r-- | doc/sphinxext/numpydoc/traitsdoc.py | 1 | ||||
| -rw-r--r-- | numpy/lib/function_base.py | 3 | ||||
| -rw-r--r-- | numpy/lib/tests/test_function_base.py | 4 | ||||
| -rw-r--r-- | numpy/ma/core.py | 4 | ||||
| -rw-r--r-- | numpy/ma/tests/test_core.py | 9 |
8 files changed, 25 insertions, 12 deletions
diff --git a/doc/sphinxext/numpydoc/docscrape_sphinx.py b/doc/sphinxext/numpydoc/docscrape_sphinx.py index 2061f3f10..03c37a4a7 100644 --- a/doc/sphinxext/numpydoc/docscrape_sphinx.py +++ b/doc/sphinxext/numpydoc/docscrape_sphinx.py @@ -1,6 +1,6 @@ from __future__ import division, absolute_import, print_function -import re, inspect, textwrap, pydoc +import sys, re, inspect, textwrap, pydoc import sphinx import collections from .docscrape import NumpyDocString, FunctionDoc, ClassDoc diff --git a/doc/sphinxext/numpydoc/numpydoc.py b/doc/sphinxext/numpydoc/numpydoc.py index b8a5e959c..4f5f716c4 100644 --- a/doc/sphinxext/numpydoc/numpydoc.py +++ b/doc/sphinxext/numpydoc/numpydoc.py @@ -150,6 +150,7 @@ class NumpyPythonDomain(ManglingDomainBase, PythonDomain): 'staticmethod': 'function', 'attribute': 'attribute', } + indices = [] class NumpyCDomain(ManglingDomainBase, CDomain): name = 'np-c' diff --git a/doc/sphinxext/numpydoc/tests/test_docscrape.py b/doc/sphinxext/numpydoc/tests/test_docscrape.py index 45bedc88a..7b7375a5a 100644 --- a/doc/sphinxext/numpydoc/tests/test_docscrape.py +++ b/doc/sphinxext/numpydoc/tests/test_docscrape.py @@ -136,7 +136,7 @@ def test_parameters(): assert_equal([n for n,_,_ in doc['Parameters']], ['mean','cov','shape']) arg, arg_type, desc = doc['Parameters'][1] - assert_equal(arg_type, '(N,N) ndarray') + assert_equal(arg_type, '(N, N) ndarray') assert desc[0].startswith('Covariance matrix') assert doc['Parameters'][0][-1][-2] == ' (1+2+3)/3' @@ -176,8 +176,8 @@ def test_index(): def non_blank_line_by_line_compare(a,b): a = textwrap.dedent(a) b = textwrap.dedent(b) - a = [l for l in a.split('\n') if l.strip()] - b = [l for l in b.split('\n') if l.strip()] + a = [l.rstrip() for l in a.split('\n') if l.strip()] + b = [l.rstrip() for l in b.split('\n') if l.strip()] for n,line in enumerate(a): if not line == b[n]: raise AssertionError("Lines %s of a and b differ: " @@ -313,7 +313,7 @@ of the one-dimensional normal distribution to higher dimensions. (1+2+3)/3 - **cov** : (N,N) ndarray + **cov** : (N, N) ndarray Covariance matrix of the distribution. @@ -563,10 +563,7 @@ def test_unicode(): """) assert isinstance(doc['Summary'][0], str) - if sys.version_info[0] >= 3: - assert doc['Summary'][0] == sixu('öäöäöäöäöåååå') - else: - assert doc['Summary'][0] == sixu('öäöäöäöäöåååå').encode('utf-8') + assert doc['Summary'][0] == 'öäöäöäöäöåååå' def test_plot_examples(): cfg = dict(use_plots=True) diff --git a/doc/sphinxext/numpydoc/traitsdoc.py b/doc/sphinxext/numpydoc/traitsdoc.py index c5f0e7912..596c54eb3 100644 --- a/doc/sphinxext/numpydoc/traitsdoc.py +++ b/doc/sphinxext/numpydoc/traitsdoc.py @@ -18,6 +18,7 @@ from __future__ import division, absolute_import, print_function import inspect import os import pydoc +import collections from . import docscrape from . import docscrape_sphinx diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 399f761ba..1ead53c87 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3695,7 +3695,8 @@ def insert(arr, obj, values, axis=None): # turn it into a range object indices = arange(*obj.indices(N),**{'dtype':intp}) else: - indices = np.asarray(obj) + # need to copy obj, because indices will be changed in-place + indices = np.array(obj) if indices.dtype == bool: # See also delete warnings.warn("in the future insert will treat boolean arrays " diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index ca329aae6..45e248913 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -232,6 +232,10 @@ class TestInsert(TestCase): a = np.array(1).view(SubClass) assert_(isinstance(np.insert(a, 0, [0]), SubClass)) + def test_index_array_copied(self): + x = np.array([1, 1, 1]) + np.insert([0, 1, 2], x, [3, 4, 5]) + assert_equal(x, np.array([1, 1, 1])) class TestAmax(TestCase): def test_basic(self): diff --git a/numpy/ma/core.py b/numpy/ma/core.py index e1e848206..38076e8b3 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -3438,12 +3438,12 @@ class MaskedArray(ndarray): return np.asanyarray(fill_value) # if m.dtype.names: - result = self._data.copy() + result = self._data.copy('K') _recursive_filled(result, self._mask, fill_value) elif not m.any(): return self._data else: - result = self._data.copy() + result = self._data.copy('K') try: np.copyto(result, fill_value, where=m) except (TypeError, AttributeError): diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index f14891087..263a9735a 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -537,6 +537,15 @@ class TestMaskedArray(TestCase): assert_equal(test, control) + def test_filled_w_f_order(self): + "Test filled w/ F-contiguous array" + a = array(np.array([(0, 1, 2), (4, 5, 6)], order='F'), + mask=np.array([(0, 0, 1), (1, 0, 0)], order='F'), + order='F') # this is currently ignored + self.assertTrue(a.flags['F_CONTIGUOUS']) + self.assertTrue(a.filled(0).flags['F_CONTIGUOUS']) + + def test_optinfo_propagation(self): "Checks that _optinfo dictionary isn't back-propagated" x = array([1, 2, 3, ], dtype=float) |
