Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed May 20, 2019
1 parent 27e9095 commit 30502fd
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions holoviews/tests/teststreams.py
Expand Up @@ -354,7 +354,16 @@ def op_method(self, obj):
def method_no_deps(self):
pass

class InnerSubObj(Inner):

sub = param.Parameter()

@param.depends('sub.x')
def subobj_method(self):
pass

self.inner = Inner
self.innersubobj = InnerSubObj

def test_param_method_depends(self):
inner = self.inner()
Expand Down Expand Up @@ -389,6 +398,19 @@ def subscriber(**kwargs):
inner.y = 2
self.assertEqual(values, [{}, {}])

def test_param_method_depends_on_subobj(self):
inner = self.innersubobj(sub=self.inner())
stream = ParamMethod(inner.subobj_method)
self.assertEqual(set(stream.parameters), {inner.sub.param.x})

values = []
def subscriber(**kwargs):
values.append(kwargs)

stream.add_subscriber(subscriber)
inner.sub.x = 2
self.assertEqual(values, [{}])

def test_dynamicmap_param_method_deps(self):
inner = self.inner()
dmap = DynamicMap(inner.method)
Expand Down Expand Up @@ -431,7 +453,7 @@ def test_dynamicmap_param_method_deps_memoization(self):
dmap[()]
dmap[()]
self.assertEqual(inner.count, 1)

def test_dynamicmap_param_method_no_deps(self):
inner = self.inner()
dmap = DynamicMap(inner.method_no_deps)
Expand Down Expand Up @@ -578,7 +600,7 @@ def cb():

# Ensure call count was incremented on init, the subscriber
# and the callback
self.assertEqual(subscriber.call_count, 3)
self.assertEqual(subscriber.call_count, 3)



Expand Down Expand Up @@ -667,7 +689,7 @@ def test_rename_suppression_reenable(self):
self.assertEquals(reenabled.contents, {'foo':0, 'y':0})



class TestPlotSizeTransform(ComparisonTestCase):

def test_plotsize_initial_contents_1(self):
Expand Down

0 comments on commit 30502fd

Please sign in to comment.