示例#1
0
def test_swap_light_and_dark_style_transformation():
    transformation = SwapLightAndDarkStyleTransformation()

    # Test with 6 digit hex colors.
    before = Attrs(
        color="440000",
        bgcolor="888844",
        bold=True,
        underline=True,
        strike=True,
        italic=True,
        blink=False,
        reverse=False,
        hidden=False,
    )
    after = Attrs(
        color="ffbbbb",
        bgcolor="bbbb76",
        bold=True,
        underline=True,
        strike=True,
        italic=True,
        blink=False,
        reverse=False,
        hidden=False,
    )

    assert transformation.transform_attrs(before) == after

    # Test with ANSI colors.
    before = Attrs(
        color="ansired",
        bgcolor="ansiblack",
        bold=True,
        underline=True,
        strike=True,
        italic=True,
        blink=False,
        reverse=False,
        hidden=False,
    )
    after = Attrs(
        color="ansibrightred",
        bgcolor="ansiwhite",
        bold=True,
        underline=True,
        strike=True,
        italic=True,
        blink=False,
        reverse=False,
        hidden=False,
    )

    assert transformation.transform_attrs(before) == after
示例#2
0
def test_swap_light_and_dark_style_transformation():
    transformation = SwapLightAndDarkStyleTransformation()

    # Test with 6 digit hex colors.
    before = Attrs(color='440000', bgcolor='888844', bold=True, underline=True,
                   italic=True, blink=False, reverse=False, hidden=False)
    after = Attrs(color='ffbbbb', bgcolor='bbbb76', bold=True, underline=True,
                   italic=True, blink=False, reverse=False, hidden=False)

    assert transformation.transform_attrs(before) == after

    # Test with ANSI colors.
    before = Attrs(color='ansired', bgcolor='ansiblack', bold=True, underline=True,
                   italic=True, blink=False, reverse=False, hidden=False)
    after = Attrs(color='ansibrightred', bgcolor='ansiwhite', bold=True, underline=True,
                   italic=True, blink=False, reverse=False, hidden=False)

    assert transformation.transform_attrs(before) == after