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()
def test_grid(): return Grid([Raw(color, background_color=color) for color in colors], cols=3, title="Grid Layout")
def test_meta_tags_in_head(): output = Raw(u"test").render_html() assert 'charset="utf8"' in output
def test_hstack(): return HStack([Raw(color, background_color=color) for color in colors], title="Horizontal Stack Layout")
def test_vstack(): return VStack([Raw(color, background_color=color) for color in colors], title="Vertical Stack Layout")
def test_raw_plain(): return Raw("Hello World!")
def _construct_style_inheritance(cls, **kwargs): return cls([Raw(color, background_color=color) for color in colors], text_align="right", title="Layout", **kwargs)
def test_raw_with_styling(): return Raw("This text should be red (on green background)!", color="red", background_color="green")
def test_raw_html(): return Raw("Some text<b>bold text</b><br/>non-bold-text<hr/>")
def test_raw_title(): return Raw("Hello World!", title="Raw Block")
def test_raw_unicode(): return Raw(u"Hello World!")
def test_raw(): return Raw("Hello World!")