Example #1
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))
Example #2
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),
    )
Example #3
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,
        ANNOTATION + [
            "location",
            "orientation",
            "height",
            "width",
            "scale_alpha",
            "title",
            "title_standoff",
            "ticker",
            "formatter",
            "color_mapper",
            "margin",
            "padding",
            "label_standoff",
            "major_tick_in",
            "major_tick_out",
            "minor_tick_in",
            "minor_tick_out",
            "major_label_overrides",
            "major_label_policy",
        ],
        prefix('title_', TEXT),
        prefix('major_label_', TEXT),
        prefix('major_tick_', LINE),
        prefix('minor_tick_', LINE),
        prefix('bar_', LINE),
        prefix('border_', LINE),
        prefix('background_', FILL),
    )