예제 #1
0
class TestImageRGBA(unittest.TestCase):

    def setUp(self):
        from bokeh.glyphs import ImageRGBA
        self.test_imagergba = ImageRGBA()

    def test_expected_properties(self):
        expected_properties = set(['image', 'x', 'y', 'dw', 'dh', ])
        actual_properties = get_prop_set(type(self.test_imagergba))
        self.assertTrue(expected_properties.issubset(actual_properties))

    def test_expected_values(self):
        self.assertEqual(self.test_imagergba.image, 'image')
        self.assertEqual(self.test_imagergba.x, 'x')
        self.assertEqual(self.test_imagergba.y, 'y')
        self.assertEqual(self.test_imagergba.dw, 'dw')
        self.assertEqual(self.test_imagergba.dh, 'dh')
        self.assertEqual(self.test_imagergba.__view_model__, 'image_rgba')

    def test_to_glyphspec(self):
        self.assertEqual(self.test_imagergba.to_glyphspec(), {'dh': {'units': 'data', 'field': 'dh'}, 'image': {'units': 'data', 'field': 'image'}, 'dw': {'units': 'data', 'field': 'dw'}, 'y': {'units': 'data', 'field': 'y'}, 'x': {'units': 'data', 'field': 'x'}, 'type': 'image_rgba'})
        self.test_imagergba.image = 'image image image'
        self.test_imagergba.width = 500
        self.test_imagergba.height = 600
        self.test_imagergba.x = 50
        self.test_imagergba.y = 51
        self.test_imagergba.dw = 53
        self.test_imagergba.dh = 54
        self.assertEqual(self.test_imagergba.to_glyphspec(), {'dh': {'units': 'data', 'value': 54}, 'image': {'units': 'data', 'field': 'image image image'}, 'x': {'units': 'data', 'value': 50}, 'y': {'units': 'data', 'value': 51}, 'dw': {'units': 'data', 'value': 53}, 'type': 'image_rgba'})
예제 #2
0
파일: test_glyphs.py 프로젝트: jqmp/bokeh
class TestImageRGBA(unittest.TestCase):
    def setUp(self):
        from bokeh.glyphs import ImageRGBA

        self.test_imagergba = ImageRGBA()

    def test_expected_properties(self):
        expected_properties = set(["image", "width", "height", "x", "y", "dw", "dh"])
        actual_properties = get_prop_set(type(self.test_imagergba))
        self.assertTrue(expected_properties.issubset(actual_properties))

    def test_expected_values(self):
        self.assertEqual(self.test_imagergba.image, "image")
        self.assertEqual(self.test_imagergba.width, "width")
        self.assertEqual(self.test_imagergba.height, "height")
        self.assertEqual(self.test_imagergba.x, "x")
        self.assertEqual(self.test_imagergba.y, "y")
        self.assertEqual(self.test_imagergba.dw, "dw")
        self.assertEqual(self.test_imagergba.dh, "dh")
        self.assertEqual(self.test_imagergba.__view_model__, "image_rgba")

    def test_to_glyphspec(self):
        self.assertEqual(
            self.test_imagergba.to_glyphspec(),
            {
                "dh": {"units": "data", "field": "dh"},
                "image": {"units": "data", "field": "image"},
                "height": {"units": "data", "field": "height"},
                "width": {"units": "data", "field": "width"},
                "dw": {"units": "data", "field": "dw"},
                "y": {"units": "data", "field": "y"},
                "x": {"units": "data", "field": "x"},
                "type": "image_rgba",
            },
        )
        self.test_imagergba.image = "image image image"
        self.test_imagergba.width = 500
        self.test_imagergba.height = 600
        self.test_imagergba.x = 50
        self.test_imagergba.y = 51
        self.test_imagergba.dw = 53
        self.test_imagergba.dh = 54
        self.assertEqual(
            self.test_imagergba.to_glyphspec(),
            {
                "dh": {"units": "data", "value": 54},
                "image": {"units": "data", "field": "image image image"},
                "height": {"units": "data", "value": 600},
                "width": {"units": "data", "value": 500},
                "x": {"units": "data", "value": 50},
                "y": {"units": "data", "value": 51},
                "dw": {"units": "data", "value": 53},
                "type": "image_rgba",
            },
        )
예제 #3
0
def test_ImageRGBA():
    glyph = ImageRGBA()
    assert glyph.image == "image"
    assert glyph.x == "x"
    assert glyph.y == "y"
    assert glyph.dw == "dw"
    assert glyph.dh == "dh"
    assert glyph.rows == "rows"
    assert glyph.cols == "cols"
    assert glyph.dilate == False
    assert glyph.anchor == Anchor.top_left
    yield check_props, glyph, [
        "image", "x", "y", "dw", "dh", "rows", "cols", "dilate", "anchor"
    ]
예제 #4
0
 def setUp(self):
     from bokeh.glyphs import ImageRGBA
     self.test_imagergba = ImageRGBA()
예제 #5
0
 def setUp(self):
     from bokeh.glyphs import ImageRGBA
     self.test_imagergba = ImageRGBA()
예제 #6
0
class TestImageRGBA(unittest.TestCase):
    def setUp(self):
        from bokeh.glyphs import ImageRGBA
        self.test_imagergba = ImageRGBA()

    def test_expected_properties(self):
        expected_properties = set([
            'image',
            'x',
            'y',
            'dw',
            'dh',
        ])
        actual_properties = get_prop_set(type(self.test_imagergba))
        self.assertTrue(expected_properties.issubset(actual_properties))

    def test_expected_values(self):
        self.assertEqual(self.test_imagergba.image, 'image')
        self.assertEqual(self.test_imagergba.x, 'x')
        self.assertEqual(self.test_imagergba.y, 'y')
        self.assertEqual(self.test_imagergba.dw, 'dw')
        self.assertEqual(self.test_imagergba.dh, 'dh')
        self.assertEqual(self.test_imagergba.__view_model__, 'image_rgba')

    def test_to_glyphspec(self):
        self.assertEqual(
            self.test_imagergba.to_glyphspec(), {
                'dh': {
                    'units': 'data',
                    'field': 'dh'
                },
                'image': {
                    'units': 'data',
                    'field': 'image'
                },
                'dw': {
                    'units': 'data',
                    'field': 'dw'
                },
                'y': {
                    'units': 'data',
                    'field': 'y'
                },
                'x': {
                    'units': 'data',
                    'field': 'x'
                },
                'type': 'image_rgba'
            })
        self.test_imagergba.image = 'image image image'
        self.test_imagergba.width = 500
        self.test_imagergba.height = 600
        self.test_imagergba.x = 50
        self.test_imagergba.y = 51
        self.test_imagergba.dw = 53
        self.test_imagergba.dh = 54
        self.assertEqual(
            self.test_imagergba.to_glyphspec(), {
                'dh': {
                    'units': 'data',
                    'value': 54
                },
                'image': {
                    'units': 'data',
                    'field': 'image image image'
                },
                'x': {
                    'units': 'data',
                    'value': 50
                },
                'y': {
                    'units': 'data',
                    'value': 51
                },
                'dw': {
                    'units': 'data',
                    'value': 53
                },
                'type': 'image_rgba'
            })