예제 #1
0
def test_op_label_template_nones():
    kw = dict(
        op_name=None,
        fn_name=None,
        penwidth=None,
        color=None,
        fillcolor=None,
        op_url=None,
        op_tooltip=None,
        op_link_target=None,
        fn_url=None,
        fn_tooltip=None,
        fn_link_target=None,
    )
    got = plot._render_template(plot.Theme.op_template, **kw)
    print(got)
    exp = """
        <<TABLE CELLBORDER="0" CELLSPACING="0" STYLE="rounded">
            <TR>
                <TD BORDER="1" SIDES="b" ALIGN="left"
                ></TD>
                <TD BORDER="1" SIDES="b" ALIGN="right"></TD>
            </TR>
        </TABLE>>
        """

    assert _striplines(got) == _striplines(exp)
예제 #2
0
def test_op_label_template_full():
    theme_op_badges = plot.Theme.op_badge_styles
    avail_badges = theme_op_badges["badge_styles"]
    kw = dict(
        op_name="the op",
        fn_name="the fn",
        penwidth="44",
        color="red",
        fontcolor="blue",
        fillcolor="wheat",
        op_truncate=plot.Theme.truncate_args,
        fn_truncate=plot.Theme.truncate_args,
        op_url="http://op_url.com<label>",
        op_tooltip='<op " \t tooltip>',
        op_link_target="_self",
        fn_url='http://fn_url.com/quoto"and',
        fn_tooltip="<fn\ntooltip>",
        fn_link_target="_top",
        badges=list(avail_badges),  # cspell: disable-line
        **theme_op_badges,
    )
    got = plot._render_template(plot.Theme.op_template, **kw)
    print(got)
    exp = """
        <<TABLE CELLBORDER="0" CELLSPACING="0" STYLE="rounded" BORDER="44" COLOR="red" BGCOLOR="wheat">
            <TR>
                <TD BORDER="1" SIDES="b" ALIGN="left" TOOLTIP="&lt;op &quot; &#9; tooltip&gt;" HREF="http://op_url.com_label_" TARGET="_self"
                ><FONT COLOR="blue"><B>OP:</B> <I>the op</I></FONT></TD>
                <TD BORDER="1" SIDES="b" ALIGN="right"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="1" CELLPADDING="2" ALIGN="right">
                        <TR>
                            <TD STYLE="rounded" HEIGHT="22" WIDTH="12" FIXEDSIZE="true" VALIGN="BOTTOM" BGCOLOR="#04277d" TITLE="endured" HREF="https://graphtik.readthedocs.io/en/latest/arch.html#term-endured" TARGET="_top"
                            ><FONT FACE="monospace" COLOR="white"><B>!</B></FONT></TD>
                            <TD STYLE="rounded" HEIGHT="22" WIDTH="12" FIXEDSIZE="true" VALIGN="BOTTOM" BGCOLOR="#fc89ac" TITLE="rescheduled" HREF="https://graphtik.readthedocs.io/en/latest/arch.html#term-partial-outputs" TARGET="_top"
                            ><FONT FACE="monospace" COLOR="white"><B>?</B></FONT></TD>
                            <TD STYLE="rounded" HEIGHT="22" WIDTH="12" FIXEDSIZE="true" VALIGN="BOTTOM" BGCOLOR="#b1ce9a" TITLE="parallel" HREF="https://graphtik.readthedocs.io/en/latest/arch.html#term-parallel-execution" TARGET="_top"
                            ><FONT FACE="monospace" COLOR="white"><B>|</B></FONT></TD>
                            <TD STYLE="rounded" HEIGHT="22" WIDTH="12" FIXEDSIZE="true" VALIGN="BOTTOM" BGCOLOR="#4e3165" TITLE="marshalled" HREF="https://graphtik.readthedocs.io/en/latest/arch.html#term-marshalling" TARGET="_top"
                            ><FONT FACE="monospace" COLOR="white"><B>&amp;</B></FONT></TD>
                            <TD STYLE="rounded" HEIGHT="22" WIDTH="12" FIXEDSIZE="true" VALIGN="BOTTOM" BGCOLOR="#cc5500" TITLE="returns_dict" HREF="https://graphtik.readthedocs.io/en/latest/arch.html#term-returns-dictionary" TARGET="_top"
                            ><FONT FACE="monospace" COLOR="white"><B>}</B></FONT></TD>
                        </TR>
                    </TABLE></TD>
            </TR><TR>
                <TD COLSPAN="2" ALIGN="left" TOOLTIP="&lt;fn&#10;tooltip&gt;" HREF="http://fn_url.com/quoto_and" TARGET="_top"
                ><FONT COLOR="blue"><B>FN:</B> the fn</FONT></TD>
            </TR>
        </TABLE>>
        """

    assert _striplines(got) == _striplines(exp)

    ## Check
    for k, v in [
        (k, v)
        for k, v in kw.items()
        if not any(i in k for i in "truncate tooltip url badge".split())
    ]:
        assert v in got, (k, v)
예제 #3
0
def test_op_label_template_empty():
    got = plot._render_template(plot.Theme.op_template)
    print(got)
    exp = """
        <<TABLE CELLBORDER="0" CELLSPACING="0" STYLE="rounded">
            <TR>
                <TD BORDER="1" SIDES="b" ALIGN="left"
                ></TD>
                <TD BORDER="1" SIDES="b" ALIGN="right"></TD>
            </TR>
        </TABLE>>
        """
    assert _striplines(got) == _striplines(exp)
예제 #4
0
def test_op_label_template_fn_empty():
    got = plot._render_template(
        plot.Theme.op_template,
        op_name="op",
        fn_name="fn",
        op_truncate=plot.Theme.truncate_args,
        fn_truncate=plot.Theme.truncate_args,
    )
    print(got)
    exp = """
        <<TABLE CELLBORDER="0" CELLSPACING="0" STYLE="rounded">
            <TR>
                <TD BORDER="1" SIDES="b" ALIGN="left"
                ><B>OP:</B> <I>op</I></TD>
                <TD BORDER="1" SIDES="b" ALIGN="right"></TD>
            </TR><TR>
                <TD COLSPAN="2" ALIGN="left"
                ><B>FN:</B> fn</TD>
            </TR>
        </TABLE>>
        """
    assert _striplines(got) == _striplines(exp)