Ejemplo n.º 1
0
def test_Title() -> None:
    title = Title()
    assert title.level == 'annotation'
    assert title.text == ""
    assert title.vertical_align == 'bottom'
    assert title.align == 'left'
    assert title.offset == 0
    assert title.text_font == 'helvetica'
    assert title.text_font_size == '13px'
    assert title.text_font_style == 'bold'
    assert title.text_color == '#444444'
    assert title.text_alpha == 1.0
    assert title.text_line_height == 1.0
    check_fill_properties(title, "background_", None, 1.0)
    check_line_properties(title, "border_", None, 1.0, 1.0)
    check_properties_existence(title, [
        "visible",
        "level",
        "text",
        "vertical_align",
        "align",
        "offset",
        "standoff",
        "text_font",
        "text_font_size",
        "text_font_style",
        "text_color",
        "text_alpha",
        "text_line_height",
        "x_range_name",
        "y_range_name",
        "render_mode"],
        prefix('border_', LINE),
        prefix('background_', FILL))
Ejemplo n.º 2
0
def test_Legend() -> None:
    legend = Legend()
    assert legend.location == 'top_right'
    assert legend.orientation == 'vertical'
    assert legend.title is None
    assert legend.title_standoff == 5
    assert legend.label_standoff == 5
    assert legend.label_height == 20
    assert legend.label_width == 20
    assert legend.glyph_height == 20
    assert legend.glyph_width == 20
    assert legend.padding == 10
    assert legend.spacing == 3
    assert legend.margin == 10
    assert legend.items == []
    check_line_properties(legend, "border_", "#e5e5e5", 1.0, 0.5)
    check_text_properties(legend, "label_", "13px", "middle", scalar=True)
    check_fill_properties(legend, "background_", "#ffffff", 0.95)
    check_properties_existence(legend, [
        "visible", "location", "orientation", "title", "title_standoff",
        "label_standoff", "label_height", "label_width", "glyph_height",
        "glyph_width", "margin", "padding", "spacing", "items", "level",
        "x_range_name", "y_range_name", "click_policy"
    ], prefix('label_', TEXT), prefix('title_', TEXT), prefix('border_', LINE),
                               prefix('background_', FILL),
                               prefix('inactive_', FILL))
Ejemplo n.º 3
0
def test_BoxAnnotation() -> None:
    box = BoxAnnotation()
    assert box.left is None
    assert box.left_units == "data"
    assert box.right is None
    assert box.right_units == "data"
    assert box.bottom is None
    assert box.bottom_units == "data"
    assert box.top is None
    assert box.top_units == "data"
    assert box.x_range_name == "default"
    assert box.y_range_name == "default"
    assert box.level == "annotation"
    check_line_properties(box, "", "#cccccc", 1, 0.3)
    check_fill_properties(box, "", "#fff9ba", 0.4)
    check_hatch_properties(box)
    check_properties_existence(
        box, ANNOTATION + [
            "left",
            "left_units",
            "right",
            "right_units",
            "bottom",
            "bottom_units",
            "top",
            "top_units",
        ], LINE, FILL, HATCH)
Ejemplo n.º 4
0
def test_Band() -> None:
    band = Band()
    assert band.level == 'annotation'
    assert band.lower == field("lower")
    assert band.lower_units == 'data'
    assert band.upper == field("upper")
    assert band.upper_units == 'data'
    assert band.base == field("base")
    assert band.dimension == 'height'
    assert isinstance(band.source, ColumnDataSource)
    assert band.x_range_name == 'default'
    assert band.y_range_name == 'default'
    check_line_properties(band, "", "#cccccc", 1.0, 0.3)
    check_fill_properties(band, "", "#fff9ba", 0.4)
    check_properties_existence(
        band, ANNOTATION + [
            "lower",
            "lower_units",
            "upper",
            "upper_units",
            "base",
            "base_units",
            "dimension",
            "source",
        ], LINE, FILL)
Ejemplo n.º 5
0
def test_LabelSet() -> None:
    label_set = LabelSet()
    assert label_set.level == 'annotation'
    assert label_set.x is None
    assert label_set.y is None
    assert label_set.x_units == 'data'
    assert label_set.y_units == 'data'
    assert label_set.text == 'text'
    assert label_set.angle == 0
    assert label_set.angle_units == 'rad'
    assert label_set.x_offset == 0
    assert label_set.y_offset == 0
    assert label_set.render_mode == 'canvas'
    assert label_set.x_range_name == 'default'
    assert label_set.y_range_name == 'default'
    assert isinstance(label_set.source, ColumnDataSource)
    assert label_set.source.data == {}
    check_text_properties(label_set)
    check_fill_properties(label_set, "background_", None, 1.0)
    check_line_properties(label_set, "border_", None, 1.0, 1.0)
    check_properties_existence(label_set, [
        "visible", "level", "x", "y", "x_units", "y_units", "text", "angle",
        "angle_units", "x_offset", "y_offset", "render_mode", "x_range_name",
        "y_range_name", "source"
    ], TEXT, ANGLE, prefix('border_', LINE), prefix('background_', FILL))
Ejemplo n.º 6
0
def test_X() -> None:
    marker = X()
    check_marker_properties(marker)
    check_line_properties(marker)
    check_fill_properties(marker)
    check_hatch_properties(marker)
    check_properties_existence(marker, MARKER, LINE, FILL, HATCH, GLYPH, ["marker"])
Ejemplo n.º 7
0
def test_BoxAnnotation() -> None:
    box = BoxAnnotation()
    assert box.left is None
    assert box.left_units == 'data'
    assert box.right is None
    assert box.right_units == 'data'
    assert box.bottom is None
    assert box.bottom_units == 'data'
    assert box.top is None
    assert box.top_units == 'data'
    assert box.x_range_name == 'default'
    assert box.y_range_name == 'default'
    assert box.level == 'annotation'
    check_line_properties(box, "", '#cccccc', 1, 0.3)
    check_fill_properties(box, "", "#fff9ba", 0.4)
    check_properties_existence(box, [
        "render_mode",
        "visible",
        "left",
        "left_units",
        "right",
        "right_units",
        "bottom",
        "bottom_units",
        "top",
        "top_units",
        "x_range_name",
        "y_range_name",
        "level",
    ], LINE, FILL)
Ejemplo n.º 8
0
def test_Label() -> None:
    label = Label(x=11, y=12)
    assert label.level == 'annotation'
    assert label.x == 11
    assert label.y == 12
    assert label.x_units == 'data'
    assert label.y_units == 'data'
    assert label.text == ""
    assert label.angle == 0
    assert label.angle_units == 'rad'
    assert label.x_offset == 0
    assert label.y_offset == 0
    assert label.x_range_name == 'default'
    assert label.y_range_name == 'default'
    check_text_properties(label, scalar=True)
    check_fill_properties(label, "background_", None, 1.0)
    check_line_properties(label, "border_", None, 1.0, 1.0)
    check_properties_existence(
        label,
        ANNOTATION + [
            "x",
            "y",
            "x_units",
            "y_units",
            "text",
            "angle",
            "angle_units",
            "x_offset",
            "y_offset",
        ],
        TEXT,
        prefix('border_', LINE),
        prefix('background_', FILL),
    )
Ejemplo n.º 9
0
def test_AnnularWedge() -> None:
    glyph = AnnularWedge()
    assert glyph.x == field("x")
    assert glyph.y == field("y")
    assert glyph.inner_radius == field("inner_radius")
    assert glyph.outer_radius == field("outer_radius")
    assert glyph.start_angle == field("start_angle")
    assert glyph.end_angle == field("end_angle")
    assert glyph.direction == "anticlock"
    check_line_properties(glyph)
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "y",
        "inner_radius",
        "inner_radius_units",
        "outer_radius",
        "outer_radius_units",
        "start_angle",
        "start_angle_units",
        "end_angle",
        "end_angle_units",
        "direction",
    ], LINE, FILL, HATCH, GLYPH)
Ejemplo n.º 10
0
def test_Title() -> None:
    title = Title()
    assert title.level == 'annotation'
    assert title.text == ""
    assert title.vertical_align == 'bottom'
    assert title.align == 'left'
    assert title.offset == 0
    assert title.text_font == 'helvetica'
    assert title.text_font_size == '13px'
    assert title.text_font_style == 'bold'
    assert title.text_color == '#444444'
    assert title.text_alpha == 1.0
    assert title.text_line_height == 1.0
    check_fill_properties(title, "background_", None, 1.0)
    check_line_properties(title, "border_", None, 1.0, 1.0)
    check_properties_existence(
        title,
        ANNOTATION + [
            "text",
            "vertical_align",
            "align",
            "offset",
            "standoff",
        ],
        TEXT,
        prefix("border_", LINE),
        prefix("background_", FILL),
    )
Ejemplo n.º 11
0
def test_ColorBar() -> None:
    color_mapper = LinearColorMapper()
    color_bar = ColorBar(color_mapper=color_mapper)
    assert color_bar.location == 'top_right'
    assert color_bar.orientation == 'auto'
    assert color_bar.height == 'auto'
    assert color_bar.width == 'auto'
    assert color_bar.scale_alpha == 1.0
    assert color_bar.title is None
    assert color_bar.title_standoff == 2
    assert color_bar.ticker == "auto"
    assert color_bar.formatter == "auto"
    assert color_bar.color_mapper == color_mapper
    assert color_bar.margin == 30
    assert color_bar.padding == 10
    assert color_bar.label_standoff == 5
    assert color_bar.major_tick_in == 5
    assert color_bar.major_tick_out == 0
    assert color_bar.minor_tick_in == 0
    assert color_bar.minor_tick_out == 0
    check_text_properties(color_bar, "title_", "13px", "bottom", "italic", scalar=True)
    check_text_properties(color_bar, "major_label_", "11px", "bottom", "normal", "left", scalar=True)
    check_line_properties(color_bar, "major_tick_", "#ffffff")
    check_line_properties(color_bar, "minor_tick_", None)
    check_line_properties(color_bar, "bar_", None)
    check_line_properties(color_bar, "border_", None)
    check_fill_properties(color_bar, "background_", "#ffffff", 0.95)
    check_properties_existence(color_bar, [
        "level",
        "visible",
        "location",
        "orientation",
        "height",
        "width",
        "scale_alpha",
        "title",
        "title_standoff",
        "ticker",
        "formatter",
        "color_mapper",
        "margin",
        "padding",
        "x_range_name",
        "y_range_name",
        "label_standoff",
        "major_tick_in",
        "major_tick_out",
        "minor_tick_in",
        "minor_tick_out",
        "major_label_overrides"],
        prefix('title_', TEXT),
        prefix('major_label_', TEXT),
        prefix('major_tick_', LINE),
        prefix('minor_tick_', LINE),
        prefix('bar_', LINE),
        prefix('border_', LINE),
        prefix('background_', FILL)
    )
Ejemplo n.º 12
0
def test_Circle() -> None:
    marker = Circle()
    check_marker_properties(marker)
    assert marker.radius is None
    check_fill_properties(marker)
    check_line_properties(marker)
    check_properties_existence(marker, [
        "radius",
        "radius_units",
        "radius_dimension",
    ], MARKER, FILL, LINE, GLYPH)
Ejemplo n.º 13
0
def test_Patches() -> None:
    glyph = Patches()
    assert glyph.xs == field("xs")
    assert glyph.ys == field("ys")
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "xs",
        "ys",
    ], FILL, HATCH, LINE, GLYPH)
Ejemplo n.º 14
0
def test_MultiPolygons() -> None:
    glyph = MultiPolygons()
    assert glyph.xs is None
    assert glyph.ys is None
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "xs",
        "ys",
    ], FILL, HATCH, LINE, GLYPH)
Ejemplo n.º 15
0
def test_Patch() -> None:
    glyph = Patch()
    assert glyph.x is None
    assert glyph.y is None
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "y",
    ], FILL, HATCH, LINE, GLYPH)
Ejemplo n.º 16
0
def test_VArea() -> None:
    glyph = VArea()
    assert glyph.x == field("x")
    assert glyph.y1 == field("y1")
    assert glyph.y2 == field("y2")
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "y1",
        "y2",
    ], FILL, HATCH, GLYPH)
Ejemplo n.º 17
0
def test_VArea() -> None:
    glyph = VArea()
    assert glyph.x is None
    assert glyph.y1 is None
    assert glyph.y2 is None
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "y1",
        "y2",
    ], FILL, HATCH, GLYPH)
Ejemplo n.º 18
0
def test_HArea() -> None:
    glyph = HArea()
    assert glyph.y == field("y")
    assert glyph.x1 == field("x1")
    assert glyph.x2 == field("x2")
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_properties_existence(glyph, [
        "y",
        "x1",
        "x2",
    ], FILL, HATCH, GLYPH)
Ejemplo n.º 19
0
def test_HArea() -> None:
    glyph = HArea()
    assert glyph.y is None
    assert glyph.x1 is None
    assert glyph.x2 is None
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_properties_existence(glyph, [
        "y",
        "x1",
        "x2",
    ], FILL, HATCH, GLYPH)
Ejemplo n.º 20
0
def test_HBar() -> None:
    glyph = HBar()
    assert glyph.y == field("y")
    assert glyph.height is None
    assert glyph.left == 0
    assert glyph.right is None
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "y",
        "height",
        "left",
        "right",
    ], FILL, HATCH, LINE, GLYPH)
Ejemplo n.º 21
0
def test_VBar() -> None:
    glyph = VBar()
    assert glyph.x == field("x")
    assert glyph.width is None
    assert glyph.top is None
    assert glyph.bottom == 0
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "width",
        "top",
        "bottom",
    ], FILL, HATCH, LINE, GLYPH)
Ejemplo n.º 22
0
def test_Quad() -> None:
    glyph = Quad()
    assert glyph.left is None
    assert glyph.right is None
    assert glyph.bottom is None
    assert glyph.top is None
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "left",
        "right",
        "bottom",
        "top",
    ], FILL, HATCH, LINE, GLYPH)
Ejemplo n.º 23
0
def test_Annulus() -> None:
    glyph = Annulus()
    assert glyph.x == field("x")
    assert glyph.y == field("y")
    assert glyph.inner_radius is None
    assert glyph.outer_radius is None
    check_fill_properties(glyph)
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "y",
        "inner_radius",
        "inner_radius_units",
        "outer_radius",
        "outer_radius_units",
    ], FILL, LINE, GLYPH)
Ejemplo n.º 24
0
def test_PolyAnnotation() -> None:
    poly = PolyAnnotation()
    assert poly.xs == []
    assert poly.xs_units == "data"
    assert poly.ys == []
    assert poly.ys_units == "data"
    assert poly.x_range_name == "default"
    assert poly.y_range_name == "default"
    assert poly.level == "annotation"
    check_line_properties(poly, "", "#cccccc", 1, 0.3)
    check_fill_properties(poly, "", "#fff9ba", 0.4)
    check_hatch_properties(poly)
    check_properties_existence(poly, ANNOTATION + [
        "xs",
        "xs_units",
        "ys",
        "ys_units",
    ], LINE, FILL, HATCH)
Ejemplo n.º 25
0
def test_Oval() -> None:
    glyph = Oval()
    assert glyph.x == field("x")
    assert glyph.y == field("y")
    assert glyph.width is None
    assert glyph.height is None
    assert glyph.angle == 0
    check_fill_properties(glyph)
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "y",
        "width",
        "width_units",
        "height",
        "height_units",
        "angle",
        "angle_units",
    ], FILL, LINE, GLYPH)
Ejemplo n.º 26
0
def test_Rect() -> None:
    glyph = Rect()
    assert glyph.x is None
    assert glyph.y is None
    assert glyph.width is None
    assert glyph.height is None
    assert glyph.angle == 0
    assert glyph.dilate is False
    check_fill_properties(glyph)
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "y",
        "width",
        "width_units",
        "height",
        "height_units",
        "angle",
        "angle_units",
        "dilate",
    ], FILL, LINE, GLYPH)
Ejemplo n.º 27
0
def test_Wedge() -> None:
    glyph = Wedge()
    assert glyph.x == field("x")
    assert glyph.y == field("y")
    assert glyph.radius is None
    assert glyph.start_angle is None
    assert glyph.end_angle is None
    assert glyph.direction == "anticlock"
    check_fill_properties(glyph)
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "y",
        "radius",
        "radius_units",
        "start_angle",
        "start_angle_units",
        "end_angle",
        "end_angle_units",
        "direction",
    ], FILL, LINE, GLYPH)
Ejemplo n.º 28
0
def test_Rect() -> None:
    glyph = Rect()
    assert glyph.x == field("x")
    assert glyph.y == field("y")
    assert glyph.width == field("width")
    assert glyph.height == field("height")
    assert glyph.angle == 0
    assert glyph.dilate is False
    check_line_properties(glyph)
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "y",
        "width",
        "width_units",
        "height",
        "height_units",
        "angle",
        "angle_units",
        "dilate",
    ], LINE, FILL, HATCH, GLYPH)
Ejemplo n.º 29
0
def test_LabelSet() -> None:
    label_set = LabelSet()
    assert label_set.level == 'annotation'
    assert label_set.x == field("x")
    assert label_set.y == field("y")
    assert label_set.x_units == 'data'
    assert label_set.y_units == 'data'
    assert label_set.text == field("text")
    assert label_set.angle == 0
    assert label_set.angle_units == 'rad'
    assert label_set.x_offset == 0
    assert label_set.y_offset == 0
    assert label_set.x_range_name == 'default'
    assert label_set.y_range_name == 'default'
    assert isinstance(label_set.source, ColumnDataSource)
    assert label_set.source.data == {}
    check_text_properties(label_set)
    check_fill_properties(label_set, "background_", None, 1.0)
    check_line_properties(label_set, "border_", None, 1.0, 1.0)
    check_properties_existence(
        label_set,
        ANNOTATION + [
            "x",
            "y",
            "x_units",
            "y_units",
            "text",
            "angle",
            "angle_units",
            "x_offset",
            "y_offset",
            "source",
        ],
        TEXT,
        ANGLE,
        prefix('border_', LINE),
        prefix('background_', FILL),
    )
Ejemplo n.º 30
0
def test_Label() -> None:
    label = Label()
    assert label.level == 'annotation'
    assert label.x is None
    assert label.y is None
    assert label.x_units == 'data'
    assert label.y_units == 'data'
    assert label.text is None
    assert label.angle == 0
    assert label.angle_units == 'rad'
    assert label.x_offset == 0
    assert label.y_offset == 0
    assert label.render_mode == 'canvas'
    assert label.x_range_name == 'default'
    assert label.y_range_name == 'default'
    check_text_properties(label, scalar=True)
    check_fill_properties(label, "background_", None, 1.0)
    check_line_properties(label, "border_", None, 1.0, 1.0)
    check_properties_existence(label, [
        "level", "visible", "x", "y", "x_units", "y_units", "text", "angle",
        "angle_units", "x_offset", "y_offset", "render_mode", "x_range_name",
        "y_range_name"
    ], TEXT, prefix('border_', LINE), prefix('background_', FILL))