Skip to content

Commit

Permalink
Added unit tests for grid slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed May 12, 2018
1 parent 0f909c2 commit 93384e4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/core/data/testdataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,18 @@ def test_canonical_vdim(self):
self.assertEqual(dataset.dimension_values('z', flat=False),
canonical)

def test_select_slice(self):
ds = self.eltype((self.grid_xs, self.grid_ys[:2],
self.grid_zs[:2]), kdims=['x', 'y'],
vdims=['z'])
self.assertEqual(self.dataset_grid.select(y=slice(0, 0.25)), ds)

def test_select_tuple(self):
ds = self.eltype((self.grid_xs, self.grid_ys[:2],
self.grid_zs[:2]), kdims=['x', 'y'],
vdims=['z'])
self.assertEqual(self.dataset_grid.select(y=(0, 0.25)), ds)

def test_dataset_ndloc_index(self):
xs, ys = np.linspace(0.12, 0.81, 10), np.linspace(0.12, 0.391, 5)
arr = np.arange(10)*np.arange(5)[np.newaxis].T
Expand Down

0 comments on commit 93384e4

Please sign in to comment.