Beispiel #1
0
 def test_dynamic_split_overlays_on_ndoverlay(self):
     dmap = DynamicMap(lambda: NdOverlay({i: Points([i]) for i in range(3)}))
     initialize_dynamic(dmap)
     keys, dmaps = dmap._split_overlays()
     self.assertEqual(keys, [(0,), (1,), (2,)])
     self.assertEqual(dmaps[0][()], Points([0]))
     self.assertEqual(dmaps[1][()], Points([1]))
     self.assertEqual(dmaps[2][()], Points([2]))
Beispiel #2
0
 def test_dynamic_split_overlays_on_overlay(self):
     dmap1 = DynamicMap(lambda: Points([]))
     dmap2 = DynamicMap(lambda: Curve([]))
     dmap = dmap1 * dmap2
     initialize_dynamic(dmap)
     keys, dmaps = dmap._split_overlays()
     self.assertEqual(keys, [('Points', 'I'), ('Curve', 'I')])
     self.assertEqual(dmaps[0][()], Points([]))
     self.assertEqual(dmaps[1][()], Curve([]))
Beispiel #3
0
 def test_dynamic_split_overlays_on_varying_order_overlay(self):
     def cb(i):
         if i%2 == 0:
             return Curve([]) * Points([])
         else:
             return Points([]) * Curve([])
     dmap = DynamicMap(cb, kdims='i').redim.range(i=(0, 4))
     initialize_dynamic(dmap)
     keys, dmaps = dmap._split_overlays()
     self.assertEqual(keys, [('Curve', 'I'), ('Points', 'I')])
     self.assertEqual(dmaps[0][0], Curve([]))
     self.assertEqual(dmaps[0][1], Curve([]))
     self.assertEqual(dmaps[1][0], Points([]))
     self.assertEqual(dmaps[1][1], Points([]))
Beispiel #4
0
 def test_dynamic_split_overlays_on_missing_item_in_overlay(self):
     def cb(i):
         if i%2 == 0:
             return Curve([]) * Points([])
         else:
             return Scatter([]) * Curve([])
     dmap = DynamicMap(cb, kdims='i').redim.range(i=(0, 4))
     initialize_dynamic(dmap)
     keys, dmaps = dmap._split_overlays()
     self.assertEqual(keys, [('Curve', 'I'), ('Points', 'I')])
     self.assertEqual(dmaps[0][0], Curve([]))
     self.assertEqual(dmaps[0][1], Curve([]))
     self.assertEqual(dmaps[1][0], Points([]))
     with self.assertRaises(KeyError):
         dmaps[1][1]
Beispiel #5
0
 def test_dmap_element_mul_dmap_overlay(self):
     test = self.dmap_element * self.dmap_overlay
     initialize_dynamic(test)
     layers = [self.dmap_element, self.dmap_overlay, self.dmap_overlay]
     self.assertEqual(split_dmap_overlay(test), layers)
Beispiel #6
0
 def test_dmap_overlay_linked_operation_mul_dmap_element_ndoverlay(self):
     mapped = self.dmap_overlay.map(lambda x: x.get(0), Overlay)
     test = mapped * self.element * self.dmap_ndoverlay
     initialize_dynamic(test)
     layers = [mapped, self.element, self.dmap_ndoverlay]
     self.assertEqual(split_dmap_overlay(test), layers)
Beispiel #7
0
 def test_dmap_overlay_linked_operation_mul_dmap_ndoverlay(self):
     mapped = operation(self.dmap_overlay, link_inputs=True)
     test = mapped * self.dmap_ndoverlay
     initialize_dynamic(test)
     layers = [mapped, mapped, self.dmap_ndoverlay]
     self.assertEqual(split_dmap_overlay(test), layers)
Beispiel #8
0
 def test_dmap_overlay_mul_overlay(self):
     test = self.dmap_overlay * self.overlay
     initialize_dynamic(test)
     layers = [self.dmap_overlay, self.dmap_overlay, self.el1, self.el2]
     self.assertEqual(split_dmap_overlay(test), layers)
Beispiel #9
0
 def test_dmap_overlay_mul_element(self):
     test = self.dmap_overlay * self.element
     initialize_dynamic(test)
     layers = [self.dmap_overlay, self.dmap_overlay, self.element]
     self.assertEqual(split_dmap_overlay(test), layers)
Beispiel #10
0
 def test_dynamicmap_numeric_values_initializes(self):
     dims = [Dimension('N', values=[10, 5, 0])]
     dmap = DynamicMap(lambda N: Curve([1, N, 5]), kdims=dims)
     initialize_dynamic(dmap)
     self.assertEqual(dmap.keys(), [0])
Beispiel #11
0
 def test_dynamicmap_default_initializes(self):
     dims = [Dimension('N', default=5, range=(0, 10))]
     dmap = DynamicMap(lambda N: Curve([1, N, 5]), kdims=dims)
     initialize_dynamic(dmap)
     self.assertEqual(dmap.keys(), [5])