Esempio n. 1
0
class TestAnnularWedge(unittest.TestCase):
    def setUp(self):
        from bokeh.glyphs import AnnularWedge
        self.test_annular_wedge = AnnularWedge()

    def test_expected_properties(self):
        expected_properties = set(['x','y','inner_radius','outer_radius','start_angle','end_angle','direction'])
        actual_properties = get_prop_set(type(self.test_annular_wedge))
        self.assertTrue(expected_properties.issubset(actual_properties))

    def test_expected_values(self):
        self.assertEqual(self.test_annular_wedge.__view_model__,'annular_wedge')
        self.assertEqual(self.test_annular_wedge.x,'x')
        self.assertEqual(self.test_annular_wedge.y,'y')
        self.assertEqual(self.test_annular_wedge.inner_radius, None)
        self.assertEqual(self.test_annular_wedge.outer_radius,None)
        self.assertEqual(self.test_annular_wedge.start_angle,'start_angle')
        self.assertEqual(self.test_annular_wedge.end_angle,'end_angle')

        self.assertEqual(self.test_annular_wedge.direction,'clock')
        self.test_annular_wedge.direction = 'anticlock'

    def test_to_glyphspec(self):
        self.assertEqual(self.test_annular_wedge.to_glyphspec(),{'line_color': {'value': 'black'}, 'fill_color': {'value': 'gray'}, 'start_angle': {'units': 'data', 'field': 'start_angle'}, 'end_angle': {'units': 'data', 'field': 'end_angle'}, 'outer_radius': {'units': 'data', 'field': None}, 'y': {'units': 'data', 'field': 'y'}, 'x': {'units': 'data', 'field': 'x'}, 'type': 'annular_wedge', 'inner_radius': {'units': 'data', 'field': None}})
        self.test_annular_wedge.x = 50
        self.test_annular_wedge.y = 100
        self.test_annular_wedge.inner_radius = 50
        self.test_annular_wedge.outer_radius = 51
        self.test_annular_wedge.start_angle = 91 
        self.test_annular_wedge.end_angle = 92
        self.test_annular_wedge.direction = 'anticlock'
        self.assertEqual(self.test_annular_wedge.to_glyphspec(), {'line_color': {'value': 'black'}, 'direction': 'anticlock', 'inner_radius': {'units': 'data', 'value': 50}, 'start_angle': {'units': 'data', 'value': 91}, 'end_angle': {'units': 'data', 'value': 92}, 'outer_radius': {'units': 'data', 'value': 51}, 'y': {'units': 'data', 'value': 100}, 'x': {'units': 'data', 'value': 50}, 'type': 'annular_wedge', 'fill_color': {'value': 'gray'}})
Esempio n. 2
0
class TestAnnularWedge(unittest.TestCase):
    def setUp(self):
        from bokeh.glyphs import AnnularWedge

        self.test_annular_wedge = AnnularWedge()

    def test_expected_properties(self):
        expected_properties = set(["x", "y", "inner_radius", "outer_radius", "start_angle", "end_angle", "direction"])
        actual_properties = get_prop_set(type(self.test_annular_wedge))
        self.assertTrue(expected_properties.issubset(actual_properties))

    def test_expected_values(self):
        self.assertEqual(self.test_annular_wedge.__view_model__, "annular_wedge")
        self.assertEqual(self.test_annular_wedge.x, "x")
        self.assertEqual(self.test_annular_wedge.y, "y")
        self.assertEqual(self.test_annular_wedge.inner_radius, None)
        self.assertEqual(self.test_annular_wedge.outer_radius, None)
        self.assertEqual(self.test_annular_wedge.start_angle, "start_angle")
        self.assertEqual(self.test_annular_wedge.end_angle, "end_angle")

        self.assertEqual(self.test_annular_wedge.direction, "clock")
        self.test_annular_wedge.direction = "anticlock"

    def test_to_glyphspec(self):
        expected = dict(GENERIC_GLYPH_DICT)
        expected["type"] = "annular_wedge"
        expected.update(
            {
                "start_angle": {"units": "data", "field": "start_angle"},
                "end_angle": {"units": "data", "field": "end_angle"},
                "outer_radius": {"units": "data", "field": None},
                "inner_radius": {"units": "data", "field": None},
            }
        )
        self.assertEqual(self.test_annular_wedge.to_glyphspec(), expected)
        self.test_annular_wedge.x = 50
        self.test_annular_wedge.y = 100
        self.test_annular_wedge.inner_radius = 50
        self.test_annular_wedge.outer_radius = 51
        self.test_annular_wedge.start_angle = 91
        self.test_annular_wedge.end_angle = 92
        self.test_annular_wedge.direction = "anticlock"
        expected.update(
            {
                "x": {"units": "data", "value": 50},
                "y": {"units": "data", "value": 100},
                "start_angle": {"units": "data", "value": 91},
                "end_angle": {"units": "data", "value": 92},
                "outer_radius": {"units": "data", "value": 51},
                "inner_radius": {"units": "data", "value": 50},
                "direction": "anticlock",
            }
        )
        self.assertEqual(self.test_annular_wedge.to_glyphspec(), expected)
Esempio n. 3
0
class TestAnnularWedge(unittest.TestCase):

    def setUp(self):
        from bokeh.glyphs import AnnularWedge
        self.test_annular_wedge = AnnularWedge()

    def test_expected_properties(self):
        expected_properties = set(['x', 'y', 'inner_radius', 'outer_radius', 'start_angle', 'end_angle', 'direction'])
        actual_properties = get_prop_set(type(self.test_annular_wedge))
        self.assertTrue(expected_properties.issubset(actual_properties))

    def test_expected_values(self):
        self.assertEqual(self.test_annular_wedge.__view_model__, 'annular_wedge')
        self.assertEqual(self.test_annular_wedge.x, 'x')
        self.assertEqual(self.test_annular_wedge.y, 'y')
        self.assertEqual(self.test_annular_wedge.inner_radius, None)
        self.assertEqual(self.test_annular_wedge.outer_radius, None)
        self.assertEqual(self.test_annular_wedge.start_angle, 'start_angle')
        self.assertEqual(self.test_annular_wedge.end_angle, 'end_angle')

        self.assertEqual(self.test_annular_wedge.direction, 'clock')
        self.test_annular_wedge.direction = 'anticlock'

    def test_to_glyphspec(self):
        expected = dict(GENERIC_GLYPH_DICT)
        expected['type'] = 'annular_wedge'
        expected.update({
            'start_angle':  {'units': 'data', 'field': 'start_angle'},
            'end_angle':    {'units': 'data', 'field': 'end_angle'},
            'outer_radius': {},
            'inner_radius': {},
        })
        self.assertEqual(self.test_annular_wedge.to_glyphspec(), expected)
        self.test_annular_wedge.x = 50
        self.test_annular_wedge.y = 100
        self.test_annular_wedge.inner_radius = 50
        self.test_annular_wedge.outer_radius = 51
        self.test_annular_wedge.start_angle = 91
        self.test_annular_wedge.end_angle = 92
        self.test_annular_wedge.direction = 'anticlock'
        expected.update({
            'x':            {'units': 'data', 'value': 50},
            'y':            {'units': 'data', 'value': 100},
            'start_angle':  {'units': 'data', 'value': 91},
            'end_angle':    {'units': 'data', 'value': 92},
            'outer_radius': {'units': 'data', 'value': 51},
            'inner_radius': {'units': 'data', 'value': 50},
            'direction':    'anticlock',
        })
        self.assertEqual(self.test_annular_wedge.to_glyphspec(), expected)
Esempio n. 4
0
 def setUp(self):
     from bokeh.glyphs import AnnularWedge
     self.test_annular_wedge = AnnularWedge()