Example #1
0
def test_Text() -> None:
    glyph = Text()
    assert glyph.x == field("x")
    assert glyph.y == field("y")
    assert glyph.text == "text"
    assert glyph.angle == 0
    check_text_properties(glyph)
    check_properties_existence(
        glyph,
        ["x", "y", "text", "angle", "angle_units", "x_offset", "y_offset"],
        TEXT, GLYPH)
Example #2
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)
Example #3
0
 def test_basic(self) -> None:
     mapper = bmm.LinearColorMapper()
     check_properties_existence(mapper, [
         "palette",
         "domain",
         "low",
         "high",
         "low_color",
         "high_color",
         "nan_color"],
     )
Example #4
0
def test_Step() -> None:
    glyph = Step()
    assert glyph.x == field("x")
    assert glyph.y == field("y")
    assert glyph.mode == "before"
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "y",
        "mode",
    ], LINE, GLYPH)
Example #5
0
def test_Patches() -> None:
    glyph = Patches()
    assert glyph.xs == field("xs")
    assert glyph.ys == field("ys")
    check_line_properties(glyph)
    check_fill_properties(glyph)
    check_hatch_properties(glyph)
    check_properties_existence(glyph, [
        "xs",
        "ys",
    ], FILL, HATCH, LINE, GLYPH)
Example #6
0
 def test_basic(self):
     r = DataRange1d()
     check_properties_existence(
         r,
         [
             "callback", "names", "renderers", "range_padding",
             "range_padding_units", "flipped", "follow", "follow_interval",
             "default_span", "start", "end", "bounds", "min_interval",
             "max_interval", "only_visible"
         ],
     )
Example #7
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)
Example #8
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)
Example #9
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)
Example #10
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)
Example #11
0
def test_Slope() -> None:
    slope = Slope()
    assert slope.gradient is None
    assert slope.y_intercept is None
    assert slope.x_range_name == 'default'
    assert slope.y_range_name == 'default'
    assert slope.level == 'annotation'
    check_line_properties(slope, "", 'black', 1.0)
    check_properties_existence(slope, ANNOTATION + [
        "gradient",
        "y_intercept",
    ], LINE)
Example #12
0
def test_Segment() -> None:
    glyph = Segment()
    assert glyph.x0 == field("x0")
    assert glyph.y0 == field("y0")
    assert glyph.x1 == field("x1")
    assert glyph.y1 == field("y1")
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "x0",
        "y0",
        "x1",
        "y1"
    ], LINE, GLYPH)
Example #13
0
def test_Span() -> None:
    line = Span()
    assert line.location is None
    assert line.location_units == 'data'
    assert line.dimension == 'width'
    assert line.x_range_name == 'default'
    assert line.y_range_name == 'default'
    assert line.level == 'annotation'
    assert line.render_mode == 'canvas'
    check_line_properties(line, "", 'black', 1.0)
    check_properties_existence(
        line, ANNOTATION +
        ["location", "location_units", "dimension", "render_mode"], LINE)
Example #14
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", "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))
Example #15
0
 def test_basic(self) -> None:
     r = FactorRange()
     check_properties_existence(r, [
         "factors",
         "factor_padding",
         "group_padding",
         "subgroup_padding",
         "range_padding",
         "range_padding_units",
         "start",
         "end",
         "bounds",
         "min_interval",
         "max_interval"],
     )
Example #16
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)
Example #17
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)
Example #18
0
def test_Ray() -> None:
    glyph = Ray()
    assert glyph.x == field("x")
    assert glyph.y == field("y")
    assert glyph.angle is None
    assert glyph.length is None
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "y",
        "angle",
        "angle_units",
        "length",
        "length_units",
    ], LINE, GLYPH)
Example #19
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)
Example #20
0
def test_ColorBar():
    color_bar = ColorBar()
    assert color_bar.location == 'top_right'
    assert color_bar.orientation == 'vertical'
    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 isinstance(color_bar.ticker, BasicTicker)
    assert isinstance(color_bar.formatter, BasicTickFormatter)
    assert color_bar.color_mapper is None
    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_",
                          "10pt",
                          "bottom",
                          "italic",
                          scalar=True)
    check_text_properties(color_bar,
                          "major_label_",
                          "8pt",
                          "middle",
                          "normal",
                          "center",
                          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", "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))
Example #21
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)
Example #22
0
def test_Quadratic() -> None:
    glyph = Quadratic()
    assert glyph.x0 == field("x0")
    assert glyph.y0 == field("y0")
    assert glyph.x1 == field("x1")
    assert glyph.y1 == field("y1")
    assert glyph.cx == field("cx")
    assert glyph.cy == field("cy")
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "x0",
        "y0",
        "x1",
        "y1",
        "cx",
        "cy",
    ], LINE, GLYPH)
Example #23
0
def test_Quadratic() -> None:
    glyph = Quadratic()
    assert glyph.x0 is None
    assert glyph.y0 is None
    assert glyph.x1 is None
    assert glyph.y1 is None
    assert glyph.cx is None
    assert glyph.cy is None
    check_line_properties(glyph)
    check_properties_existence(glyph, [
        "x0",
        "y0",
        "x1",
        "y1",
        "cx",
        "cy",
    ], LINE, GLYPH)
Example #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)
Example #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)
Example #26
0
def test_ImageRGBA() -> None:
    glyph = ImageRGBA()
    assert glyph.image is None
    assert glyph.x == field("x")
    assert glyph.y == field("y")
    assert glyph.dw is None
    assert glyph.dh is None
    assert glyph.dilate is False
    check_properties_existence(glyph, [
        "image",
        "x",
        "y",
        "dw",
        "dw_units",
        "dh",
        "dh_units",
        "global_alpha",
        "dilate",
    ], GLYPH)
Example #27
0
def test_Arrow() -> None:
    arrow = Arrow()
    assert arrow.x_start is None
    assert arrow.y_start is None
    assert arrow.start_units == 'data'
    assert arrow.start is None
    assert arrow.x_end is None
    assert arrow.y_end is None
    assert arrow.end_units == 'data'
    assert isinstance(arrow.end, ArrowHead)
    assert isinstance(arrow.source, ColumnDataSource)
    assert arrow.x_range_name == "default"
    assert arrow.y_range_name == "default"
    check_line_properties(arrow)
    check_properties_existence(arrow, [
        "level", "visible", "x_start", "y_start", "start_units", "start",
        "x_end", "y_end", "end_units", "end", "source", "x_range_name",
        "y_range_name"
    ], LINE)
Example #28
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,
        ANNOTATION + [
            "location",
            "orientation",
            "title",
            "title_standoff",
            "label_standoff",
            "label_height",
            "label_width",
            "glyph_height",
            "glyph_width",
            "margin",
            "padding",
            "spacing",
            "items",
            "click_policy",
        ],
        prefix('label_', TEXT),
        prefix('title_', TEXT),
        prefix('border_', LINE),
        prefix('background_', FILL),
        prefix('inactive_', FILL),
    )
Example #29
0
def test_Arc() -> None:
    glyph = Arc()
    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_line_properties(glyph)
    check_properties_existence(glyph, [
        "x",
        "y",
        "radius",
        "radius_units",
        "start_angle",
        "start_angle_units",
        "end_angle",
        "end_angle_units",
        "direction",
    ], LINE, GLYPH)
Example #30
0
def test_Image() -> None:
    glyph = Image()
    assert glyph.image == field("image")
    assert glyph.x == field("x")
    assert glyph.y == field("y")
    assert glyph.dw == field("dw")
    assert glyph.dh == field("dh")
    assert glyph.dilate is False
    check_properties_existence(glyph, [
        "image",
        "x",
        "y",
        "dw",
        "dw_units",
        "dh",
        "dh_units",
        "global_alpha",
        "dilate",
        "color_mapper",
    ], GLYPH)