Skip to content

Commit 0a8b8a0

Browse files
committed
test indices API
1 parent f038dd8 commit 0a8b8a0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cf/test/test_Field.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,6 +1679,14 @@ def test_Field_indices(self):
16791679
g = f[indices]
16801680
self.assertFalse(np.ma.is_masked(g.array))
16811681

1682+
# Test API with 0/1/2 arguments
1683+
kwargs = {"grid_latitude": [1]}
1684+
i = f.indices(**kwargs)
1685+
j = f.indices(0, **kwargs)
1686+
k = f.indices("compress", 0, **kwargs)
1687+
self.assertEqual(i, j)
1688+
self.assertEqual(i, k)
1689+
16821690
# Subspace has size 0 axis resulting from dask array index
16831691
indices = f.indices(grid_latitude=cf.contains(-23.2))
16841692
with self.assertRaises(IndexError):

0 commit comments

Comments
 (0)