Skip to content

Commit

Permalink
Fixed test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Mar 28, 2018
1 parent 10921d4 commit bfa39ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 2 additions & 1 deletion holoviews/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def __call__(self, *args, **params):
options, obj = args[0], None
elif len(args) == 2:
(options, obj) = args
backend = params.pop('backend', None)

if isinstance(options, basestring):
from .parser import OptsSpec
Expand All @@ -102,7 +103,7 @@ def __call__(self, *args, **params):
elif not isinstance(obj, Dimensioned):
return obj
else:
return StoreOptions.set_options(obj, options)
return StoreOptions.set_options(obj, options, backend=backend)


@classmethod
Expand Down
9 changes: 3 additions & 6 deletions tests/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,18 @@ def setUp(self):
self.store_copy = OptionTree(sorted(Store.options().items()),
groups=['style', 'plot', 'norm'])
self.backend = 'matplotlib'

super(TestOptsUtil, self).setUp()

def tearDown(self):
Store.options(val=self.store_copy)
Store._custom_options = {k:{} for k in Store._custom_options.keys()}
super(TestOptsUtil, self).tearDown()


def test_cell_opts_util_style(self):
mat1 = hv.Image(np.random.rand(5,5), name='mat1')
self.assertEqual(mat1.id, None)
opts("Image (cmap='hot')", mat1)
opts("Image (cmap='hot')", mat1, backend='matplotlib')
self.assertNotEqual(mat1.id, None)

self.assertEqual(
Store.lookup_options('matplotlib',
mat1, 'style').options.get('cmap',None),'hot')
Expand All @@ -110,7 +107,7 @@ def test_cell_opts_util_plot(self):
mat1 = hv.Image(np.random.rand(5,5), name='mat1')

self.assertEqual(mat1.id, None)
opts("Image [show_title=False]", mat1)
opts("Image [show_title=False]", mat1, backend='matplotlib')
self.assertNotEqual(mat1.id, None)
self.assertEqual(
Store.lookup_options('matplotlib',
Expand All @@ -120,7 +117,7 @@ def test_cell_opts_util_plot(self):
def test_cell_opts_util_norm(self):
mat1 = hv.Image(np.random.rand(5,5), name='mat1')
self.assertEqual(mat1.id, None)
opts("Image {+axiswise}", mat1)
opts("Image {+axiswise}", mat1, backend='matplotlib')
self.assertNotEqual(mat1.id, None)

self.assertEqual(
Expand Down

0 comments on commit bfa39ef

Please sign in to comment.