diff --git a/biggus/__init__.py b/biggus/__init__.py index 438c7c1..3377ea2 100644 --- a/biggus/__init__.py +++ b/biggus/__init__.py @@ -63,7 +63,7 @@ import numpy.ma as ma -__version__ = '0.9.0' +__version__ = '0.9.1' _SCALAR_KEY_TYPES = (int, np.integer) @@ -2619,9 +2619,10 @@ def _full_keys(keys, ndim): # Numpy allows an extra dimension to be an Ellipsis, we remove it here # if Ellipsis is in keys, if this doesn't trigger we will raise an # IndexError. - if n_keys_non_newaxis - 1 >= ndim and Ellipsis in keys: + is_ellipsis = [key is Ellipsis for key in keys] + if n_keys_non_newaxis - 1 >= ndim and any(is_ellipsis): # Remove the left-most Ellipsis, as numpy does. - keys.remove(Ellipsis) + keys.pop(is_ellipsis.index(True)) n_keys_non_newaxis -= 1 if n_keys_non_newaxis > ndim: diff --git a/biggus/tests/unit/test__full_keys.py b/biggus/tests/unit/test__full_keys.py index 1d81da3..c97681a 100644 --- a/biggus/tests/unit/test__full_keys.py +++ b/biggus/tests/unit/test__full_keys.py @@ -30,7 +30,7 @@ def nslice(self, n): def assertFullSlice(self, keys, ndim, expected): result = _full_keys(keys, ndim) - self.assertEqual(result, tuple(expected)) + assert_array_equal(result, tuple(expected)) # Now check that this is actually the numpy behaviour. a = np.empty(range(7, 7 + ndim), dtype=np.bool) @@ -69,6 +69,11 @@ def test_new_axis(self): self.assertFullSlice((np.newaxis, ), 2, [np.newaxis, slice(None), slice(None)]) + def test_numpy_and_ellipsis_1d(self): + # The key is that Ellipsis needs to be stripped off the keys. + self.assertFullSlice((np.array([0, 4, 5, 2]), Ellipsis), 1, + [np.array([0, 4, 5, 2])]) + def test_new_axis_lh_and_rh(self): self.assertFullSlice((np.newaxis, Ellipsis, None, np.newaxis), 2, [None, slice(None), slice(None), None, None]) diff --git a/doc/conf.py b/doc/conf.py index 9840122..e0397e0 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -43,16 +43,16 @@ # General information about the project. project = u'Biggus' -copyright = u'2014, Richard Hattersley' +copyright = 'British Crown Copyright 2014 - 2015, Met Office' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '0.9.0' +version = '0.9.1' # The full version, including alpha/beta/rc tags. -release = '0.9.0' +release = '0.9.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index 26bff9a..9fe5410 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ def run(self): setup( name='Biggus', - version='0.9.0', + version='0.9.1', url='https://github.com/SciTools/biggus', author='Richard Hattersley', author_email='rhattersley@gmail.com',