예제 #1
0
class TestQuadratic(unittest.TestCase):
    def setUp(self):
        from bokeh.glyphs import Quadratic
        self.test_quadratic = Quadratic()

    def test_expected_properties(self):
        expected_properties = set(['x0','y0','x1','y1','cx','cy'])
        actual_properties = get_prop_set(type(self.test_quadratic))
        self.assertTrue(expected_properties.issubset(actual_properties))

    def test_expected_values(self):
        self.assertEqual(self.test_quadratic.x0,'x0')
        self.assertEqual(self.test_quadratic.y0,'y0')
        self.assertEqual(self.test_quadratic.x1,'x1')
        self.assertEqual(self.test_quadratic.y1,'y1')
        self.assertEqual(self.test_quadratic.cx,'cx')
        self.assertEqual(self.test_quadratic.cy,'cy')
        self.assertEqual(self.test_quadratic.__view_model__,'quadratic')

    def test_to_glyphspec(self):
        self.assertEqual(self.test_quadratic.to_glyphspec(), {'line_color': {'value': 'black'}, 'fill_color': {'value': 'gray'}, 'cy': {'units': 'data', 'field': 'cy'}, 'cx': {'units': 'data', 'field': 'cx'}, 'y1': {'units': 'data', 'field': 'y1'}, 'y0': {'units': 'data', 'field': 'y0'}, 'x0': {'units': 'data', 'field': 'x0'}, 'x1': {'units': 'data', 'field': 'x1'}, 'type': 'quadratic'})
        self.test_quadratic.x0 = 1
        self.test_quadratic.x1 = 2
        self.test_quadratic.cx = 3
        self.test_quadratic.y0 = 4
        self.test_quadratic.y1 = 5
        self.test_quadratic.cy = 6
        self.assertEqual(self.test_quadratic.to_glyphspec(), {'line_color': {'value': 'black'}, 'fill_color': {'value': 'gray'}, 'cy': {'units': 'data', 'value': 6}, 'cx': {'units': 'data', 'value': 3}, 'y1': {'units': 'data', 'value': 5}, 'y0': {'units': 'data', 'value': 4}, 'x0': {'units': 'data', 'value': 1}, 'x1': {'units': 'data', 'value': 2}, 'type': 'quadratic'})
예제 #2
0
class TestQuadratic(unittest.TestCase):
    def setUp(self):
        from bokeh.glyphs import Quadratic

        self.test_quadratic = Quadratic()

    def test_expected_properties(self):
        expected_properties = set(["x0", "y0", "x1", "y1", "cx", "cy"])
        actual_properties = get_prop_set(type(self.test_quadratic))
        self.assertTrue(expected_properties.issubset(actual_properties))

    def test_expected_values(self):
        self.assertEqual(self.test_quadratic.x0, "x0")
        self.assertEqual(self.test_quadratic.y0, "y0")
        self.assertEqual(self.test_quadratic.x1, "x1")
        self.assertEqual(self.test_quadratic.y1, "y1")
        self.assertEqual(self.test_quadratic.cx, "cx")
        self.assertEqual(self.test_quadratic.cy, "cy")
        self.assertEqual(self.test_quadratic.__view_model__, "quadratic")

    def test_to_glyphspec(self):
        expected = {}
        expected["type"] = "quadratic"
        expected.update(GENERIC_LINE_DICT)
        expected.update(
            {
                "x0": {"units": "data", "field": "x0"},
                "x1": {"units": "data", "field": "x1"},
                "y0": {"units": "data", "field": "y0"},
                "y1": {"units": "data", "field": "y1"},
                "cx": {"units": "data", "field": "cx"},
                "cy": {"units": "data", "field": "cy"},
            }
        )
        self.assertEqual(self.test_quadratic.to_glyphspec(), expected)
        self.test_quadratic.x0 = 1
        self.test_quadratic.x1 = 2
        self.test_quadratic.cx = 3
        self.test_quadratic.y0 = 4
        self.test_quadratic.y1 = 5
        self.test_quadratic.cy = 6
        expected.update(
            {
                "x0": {"units": "data", "value": 1},
                "x1": {"units": "data", "value": 2},
                "y0": {"units": "data", "value": 4},
                "y1": {"units": "data", "value": 5},
                "cx": {"units": "data", "value": 3},
                "cy": {"units": "data", "value": 6},
            }
        )
        self.assertEqual(self.test_quadratic.to_glyphspec(), expected)
예제 #3
0
class TestQuadratic(unittest.TestCase):

    def setUp(self):
        from bokeh.glyphs import Quadratic
        self.test_quadratic = Quadratic()

    def test_expected_properties(self):
        expected_properties = set(['x0', 'y0', 'x1', 'y1', 'cx', 'cy'])
        actual_properties = get_prop_set(type(self.test_quadratic))
        self.assertTrue(expected_properties.issubset(actual_properties))

    def test_expected_values(self):
        self.assertEqual(self.test_quadratic.x0, 'x0')
        self.assertEqual(self.test_quadratic.y0, 'y0')
        self.assertEqual(self.test_quadratic.x1, 'x1')
        self.assertEqual(self.test_quadratic.y1, 'y1')
        self.assertEqual(self.test_quadratic.cx, 'cx')
        self.assertEqual(self.test_quadratic.cy, 'cy')
        self.assertEqual(self.test_quadratic.__view_model__, 'quadratic')

    def test_to_glyphspec(self):
        expected = {}
        expected['type'] = 'quadratic'
        expected.update(GENERIC_LINE_DICT)
        expected.update({
            'x0': {'units': 'data', 'field': 'x0'},
            'x1': {'units': 'data', 'field': 'x1'},
            'y0': {'units': 'data', 'field': 'y0'},
            'y1': {'units': 'data', 'field': 'y1'},
            'cx': {'units': 'data', 'field': 'cx'},
            'cy': {'units': 'data', 'field': 'cy'},
        })
        self.assertEqual(self.test_quadratic.to_glyphspec(), expected)
        self.test_quadratic.x0 = 1
        self.test_quadratic.x1 = 2
        self.test_quadratic.cx = 3
        self.test_quadratic.y0 = 4
        self.test_quadratic.y1 = 5
        self.test_quadratic.cy = 6
        expected.update({
            'x0': {'units': 'data', 'value': 1},
            'x1': {'units': 'data', 'value': 2},
            'y0': {'units': 'data', 'value': 4},
            'y1': {'units': 'data', 'value': 5},
            'cx': {'units': 'data', 'value': 3},
            'cy': {'units': 'data', 'value': 6},
        })
        self.assertEqual(self.test_quadratic.to_glyphspec(), expected)
예제 #4
0
def test_Quadratic():
    glyph = Quadratic()
    assert glyph.x0 == "x0"
    assert glyph.y0 == "y0"
    assert glyph.x1 == "x1"
    assert glyph.y1 == "y1"
    assert glyph.cx == "cx"
    assert glyph.cy == "cy"
    yield check_line, glyph
    yield check_props, glyph, ["x0", "y0", "x1", "y1", "cx", "cy"], LINE
예제 #5
0
 def setUp(self):
     from bokeh.glyphs import Quadratic
     self.test_quadratic = Quadratic()
예제 #6
0
  Oval(x="x",
       y="y",
       width=screen(15),
       height=screen(25),
       angle=-0.7,
       fill_color="#1D91C0")),
 ("patch", Patch(x="x", y="y", fill_color="#A6CEE3")),
 ("patches", Patches(xs="xs", ys="ys", fill_color="#FB9A99")),
 ("quad",
  Quad(left="x", right="xm01", top="y", bottom="ym01",
       fill_color="#B3DE69")),
 ("quadratic",
  Quadratic(x0="x",
            y0="y",
            x1="xp02",
            y1="y",
            cx="xp01",
            cy="yp01",
            line_color="#4DAF4A",
            line_width=3)),
 ("ray",
  Ray(x="x",
      y="y",
      length=45,
      angle=-0.7,
      line_color="#FB8072",
      line_width=2)),
 ("rect",
  Rect(x="x",
       y="y",
       width=screen(10),
       height=screen(20),
예제 #7
0
 def setUp(self):
     from bokeh.glyphs import Quadratic
     self.test_quadratic = Quadratic()
예제 #8
0
class TestQuadratic(unittest.TestCase):
    def setUp(self):
        from bokeh.glyphs import Quadratic
        self.test_quadratic = Quadratic()

    def test_expected_properties(self):
        expected_properties = set(['x0', 'y0', 'x1', 'y1', 'cx', 'cy'])
        actual_properties = get_prop_set(type(self.test_quadratic))
        self.assertTrue(expected_properties.issubset(actual_properties))

    def test_expected_values(self):
        self.assertEqual(self.test_quadratic.x0, 'x0')
        self.assertEqual(self.test_quadratic.y0, 'y0')
        self.assertEqual(self.test_quadratic.x1, 'x1')
        self.assertEqual(self.test_quadratic.y1, 'y1')
        self.assertEqual(self.test_quadratic.cx, 'cx')
        self.assertEqual(self.test_quadratic.cy, 'cy')
        self.assertEqual(self.test_quadratic.__view_model__, 'quadratic')

    def test_to_glyphspec(self):
        expected = {}
        expected['type'] = 'quadratic'
        expected.update(GENERIC_LINE_DICT)
        expected.update({
            'x0': {
                'units': 'data',
                'field': 'x0'
            },
            'x1': {
                'units': 'data',
                'field': 'x1'
            },
            'y0': {
                'units': 'data',
                'field': 'y0'
            },
            'y1': {
                'units': 'data',
                'field': 'y1'
            },
            'cx': {
                'units': 'data',
                'field': 'cx'
            },
            'cy': {
                'units': 'data',
                'field': 'cy'
            },
        })
        self.assertEqual(self.test_quadratic.to_glyphspec(), expected)
        self.test_quadratic.x0 = 1
        self.test_quadratic.x1 = 2
        self.test_quadratic.cx = 3
        self.test_quadratic.y0 = 4
        self.test_quadratic.y1 = 5
        self.test_quadratic.cy = 6
        expected.update({
            'x0': {
                'units': 'data',
                'value': 1
            },
            'x1': {
                'units': 'data',
                'value': 2
            },
            'y0': {
                'units': 'data',
                'value': 4
            },
            'y1': {
                'units': 'data',
                'value': 5
            },
            'cx': {
                'units': 'data',
                'value': 3
            },
            'cy': {
                'units': 'data',
                'value': 6
            },
        })
        self.assertEqual(self.test_quadratic.to_glyphspec(), expected)