示例#1
0
 def test_multi_point_roundtrip(self):
     xs = [1, 2, 3, 2]
     ys = [2, 0, 7, 4]
     points = Points([{
         'x': xs,
         'y': ys,
         'z': 0
     }, {
         'x': xs[::-1],
         'y': ys[::-1],
         'z': 1
     }], ['x', 'y'],
                     'z',
                     datatype=[self.datatype])
     self.assertIsInstance(points.data.geometry.dtype, MultiPointDtype)
     roundtrip = points.clone(datatype=['multitabular'])
     self.assertEqual(roundtrip.interface.datatype, 'multitabular')
     expected = Points([{
         'x': xs,
         'y': ys,
         'z': 0
     }, {
         'x': xs[::-1],
         'y': ys[::-1],
         'z': 1
     }], ['x', 'y'],
                       'z',
                       datatype=['multitabular'])
     self.assertEqual(roundtrip, expected)
示例#2
0
 def test_point_roundtrip(self):
     points = Points([{
         'x': 0,
         'y': 1,
         'z': 0
     }, {
         'x': 1,
         'y': 0,
         'z': 1
     }], ['x', 'y'],
                     'z',
                     datatype=[self.datatype])
     self.assertIsInstance(points.data.geometry.dtype, PointDtype)
     roundtrip = points.clone(datatype=['multitabular'])
     self.assertEqual(roundtrip.interface.datatype, 'multitabular')
     expected = Points([{
         'x': 0,
         'y': 1,
         'z': 0
     }, {
         'x': 1,
         'y': 0,
         'z': 1
     }], ['x', 'y'],
                       'z',
                       datatype=['multitabular'])
     self.assertEqual(roundtrip, expected)
示例#3
0
 def test_stream_callback_on_clone(self):
     points = Points([])
     stream = PointerXY(source=points)
     plot = bokeh_server_renderer.get_plot(points.clone())
     bokeh_server_renderer(plot)
     plot.callbacks[0].on_msg({"x": 0.8, "y": 0.3})
     self.assertEqual(stream.x, 0.8)
     self.assertEqual(stream.y, 0.3)
示例#4
0
 def test_stream_callback_on_clone(self):
     points = Points([])
     stream = PointerXY(source=points)
     plot = bokeh_server_renderer.get_plot(points.clone())
     bokeh_server_renderer(plot)
     plot.callbacks[0].on_msg({"x": 0.8, "y": 0.3})
     self.assertEqual(stream.x, 0.8)
     self.assertEqual(stream.y, 0.3)
示例#5
0
 def test_stream_callback_on_unlinked_clone(self):
     points = Points([])
     PointerXY(source=points)
     plot = bokeh_server_renderer.get_plot(points.clone(link=False))
     bokeh_server_renderer(plot)
     self.assertTrue(len(plot.callbacks) == 0)
示例#6
0
 def test_stream_callback_on_unlinked_clone(self):
     points = Points([])
     PointerXY(source=points)
     plot = bokeh_server_renderer.get_plot(points.clone(link=False))
     bokeh_server_renderer(plot)
     self.assertTrue(len(plot.callbacks) == 0)