Exemplo n.º 1
0
def test_row_fg_colors_and_bg_colors_supports_ansi_false(fg_colors, bg_colors):
    os.environ["ANSI_COLORS_DISABLED"] = "True"
    result = row(("Hello", "World", "12344342"),
                 fg_colors=fg_colors,
                 bg_colors=bg_colors)
    assert result == "Hello   World   12344342"
    del os.environ["ANSI_COLORS_DISABLED"]
Exemplo n.º 2
0
def test_row_fg_colors_and_bg_colors_log_friendly(fg_colors, bg_colors):
    ENV_LOG_FRIENDLY = "WASABI_LOG_FRIENDLY"
    os.environ[ENV_LOG_FRIENDLY] = "True"
    result = row(("Hello", "World", "12344342"),
                 fg_colors=fg_colors,
                 bg_colors=bg_colors)
    assert result == "Hello   World   12344342"
    del os.environ[ENV_LOG_FRIENDLY]
Exemplo n.º 3
0
def test_row_bg_colors(bg_colors):
    result = row(("Hello", "World", "12344342"), bg_colors=bg_colors)
    if SUPPORTS_ANSI:
        assert (
            result ==
            "\x1b[48;5;2mHello\x1b[0m   \x1b[48;5;23mWorld\x1b[0m   12344342")
    else:
        assert result == "Hello   World   12344342"
Exemplo n.º 4
0
def test_row_fg_colors(fg_colors):
    result = row(("Hello", "World", "12344342"), fg_colors=fg_colors)
    if SUPPORTS_ANSI:
        assert (
            result ==
            "Hello   \x1b[38;5;3mWorld\x1b[0m   \x1b[38;5;87m12344342\x1b[0m")
    else:
        assert result == "Hello   World   12344342"
Exemplo n.º 5
0
def test_row_fg_colors_and_bg_colors_log_friendly_prefix(fg_colors, bg_colors):
    ENV_LOG_FRIENDLY = "CUSTOM_LOG_FRIENDLY"
    os.environ[ENV_LOG_FRIENDLY] = "True"
    result = row(
        ("Hello", "World", "12344342"),
        fg_colors=fg_colors,
        bg_colors=bg_colors,
        env_prefix="CUSTOM",
    )
    assert result == "Hello   World   12344342"
    del os.environ[ENV_LOG_FRIENDLY]
Exemplo n.º 6
0
def test_row_single_widths():
    data = ("a", "bb", "ccc")
    result = row(data, widths=10)
    assert result == "a            bb           ccc       "