Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Dec 12, 2019
1 parent ad9e6b3 commit 9a0447f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
15 changes: 10 additions & 5 deletions holoviews/core/data/multipath.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,22 @@ def select(cls, dataset, selection_mask=None, **selection):
"""
Applies selectiong on all the subpaths.
"""
if not dataset.data:
return []
if cls.geom_type(type(dataset)):
xdim, ydim = dataset.kdims[:2]
selection.pop(xdim.name, None)
selection.pop(ydim.name, None)
if not selection or not dataset.data:
return dataset.data
ds = cls._inner_dataset_template(dataset)
data = []
for d in dataset.data:
ds.data = d
selection_mask = ds.interface.select_mask(ds, selection)
sel = ds.interface.select(ds, selection_mask)
if ((not len(sel) and not isinstance(sel, dict)) or
any(False if util.isscalar(v) else len(v) == 0
for k, v in sel.items() if k != 'holes')):
is_dict = isinstance(sel, dict)
if ((not len(sel) and not is_dict) or
(is_dict and any(False if util.isscalar(v) else len(v) == 0
for k, v in sel.items() if k != 'holes'))):
continue
data.append(sel)
return data
Expand Down
12 changes: 4 additions & 8 deletions holoviews/core/data/spatialpandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,10 @@ def holes(cls, dataset):

@classmethod
def select(cls, dataset, selection_mask=None, **selection):
geom_dims = cls.geom_dims(dataset)
if any(s in geom_dims for s in selection):
xdim, ydim = cls.geom_dims(dataset)
selection.pop(xdim.name, None)
selection.pop(ydim.name, None)
df = dataset.data
else:
df = dataset.data
xdim, ydim = cls.geom_dims(dataset)
selection.pop(xdim.name, None)
selection.pop(ydim.name, None)
df = dataset.data
if not selection:
return df
elif selection_mask is None:
Expand Down
3 changes: 2 additions & 1 deletion holoviews/tests/core/data/testmultiinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
except:
dd = None


class GeomTests(ComparisonTestCase):
"""
Test of the MultiInterface.
Expand Down Expand Up @@ -348,7 +349,7 @@ def test_multi_polygon_get_holes(self):
self.assertEqual(poly.holes(), holes)

def test_polygon_dtype(self):
poly = Polygons([{'x': [1, 2, 3], 'y': [2, 0, 7]}])
poly = Polygons([{'x': [1, 2, 3], 'y': [2, 0, 7]}], datatype=[self.datatype])
self.assertIs(poly.interface, self.interface)
self.assertEqual(poly.interface.dtype(poly, 'x'),
'int64')
Expand Down

0 comments on commit 9a0447f

Please sign in to comment.