Ejemplo n.º 1
0
def test_layout_smart_wrapping(page_layout):
    strings = ["first", "second", "third"]
    output = page_layout + la.Section(*strings, "fourth", la.Column("fifth"),
                                      "sixth")
    expected = page_layout()
    expected += la.Section(*[co.Markdown(x) for x in strings],
                           la.Row("fourth", la.Column("fifth"), "sixth"))
    print(output)
    print()
    print(expected)
    assert output == expected
Ejemplo n.º 2
0
def test_content_add(a, b):
    output = a + b
    expected = la.Row(a, b)
    assert output == expected
Ejemplo n.º 3
0
def page_layout(content_list_fn) -> la.Page:
    return la.Page(
        la.Section(la.Row(*[la.Column(x) for x in content_list_fn])), title="jazz"
    )
Ejemplo n.º 4
0
with Path(_irises_path).open("rb") as f:
    _irises_binary = BytesIO(f.read())


# Add new content classes here
content_list = [
    (co.Markdown("this _is_ some **markdown**")),
    (co.Image(_irises_path)),
]

# Add new layout classes here
layout_list = [
    (la.Page(*content_list)),
    (la.Section(*content_list)),
    (la.Row(*content_list)),
    (la.Column(*content_list)),
]

# Add new adaptor types here
adaptor_list = [
    ("this is markdown", co.Markdown),
    (_irises_path, co.Image),
]

if _EXTRAS:
    import bokeh.layouts as bkl  # type: ignore
    import bokeh.plotting as bkp  # type: ignore
    import matplotlib.pyplot as plt  # type: ignore
    import pandas as pd  # type: ignore
    import plotly.express as px  # type: ignore
Ejemplo n.º 5
0
    assert a == page_layout


def test_layout_equality(layout_list_fn):
    for i, a in enumerate(layout_list_fn):
        for j, b in enumerate(layout_list_fn):
            if i == j:
                assert a == b
            else:
                assert a != b


layout_add_list = [
    (la.Column(), "miles davis", la.Column(co.Markdown("miles davis"))),
    (
        la.Row(),
        co.Markdown("ornette coleman"),
        la.Row(la.Column(co.Markdown("ornette coleman"))),
    ),
    (
        la.Page("charles mingus"),
        la.Section("thelonious monk"),
        la.Page(["charles mingus", "thelonious monk"]),
    ),
    (
        la.Section(title="jazz"),
        la.Row(la.Column("john coltrane"), la.Column("wayne shorter")),
        la.Section(la.Row(la.Column("john coltrane"),
                          la.Column("wayne shorter")),
                   title="jazz"),
    ),