Exemple #1
0
import pandas as pd
import pybloqs.plot as pbp

from pybloqs.block.text import Raw
from pybloqs.block.base import HRule
from .generation_framework import assert_report_generated

HELLO_WORLD = Raw("Hello World!", title="A Title")


def _create_dynamic_content():
    d = pd.date_range("2012-01-01", periods=10)
    s = pd.Series(range(len(d)), d)

    return pbp.Plot(s, width="100%", height="100%")


@assert_report_generated
def test_hrule():
    return HRule()


@assert_report_generated(fmt="png")
def test_save_image():
    return HELLO_WORLD


@assert_report_generated(fmt="png")
def test_save_image_dynamic_content():
    return _create_dynamic_content()
Exemple #2
0
def test_grid():
    return Grid([Raw(color, background_color=color) for color in colors], cols=3, title="Grid Layout")
Exemple #3
0
def test_meta_tags_in_head():
    output = Raw(u"test").render_html()
    assert 'charset="utf8"' in output
Exemple #4
0
def test_hstack():
    return HStack([Raw(color, background_color=color) for color in colors], title="Horizontal Stack Layout")
Exemple #5
0
def test_vstack():
    return VStack([Raw(color, background_color=color) for color in colors], title="Vertical Stack Layout")
Exemple #6
0
def test_raw_plain():
    return Raw("Hello World!")
Exemple #7
0
def _construct_style_inheritance(cls, **kwargs):
    return cls([Raw(color, background_color=color) for color in colors], text_align="right", title="Layout", **kwargs)
Exemple #8
0
def test_raw_with_styling():
    return Raw("This text should be red (on green background)!",
               color="red",
               background_color="green")
Exemple #9
0
def test_raw_html():
    return Raw("Some text<b>bold text</b><br/>non-bold-text<hr/>")
Exemple #10
0
def test_raw_title():
    return Raw("Hello World!", title="Raw Block")
Exemple #11
0
def test_raw_unicode():
    return Raw(u"Hello World!")
Exemple #12
0
def test_raw():
    return Raw("Hello World!")