@pytest.mark.parametrize(('css_source', 'expected_result'), [
    ('', None),
    (' /* hey */\n', None),
    ('4', None),
    ('top', None),
    ('/**/transparent', (0, 0, 0, 0)),
    ('transparent', (0, 0, 0, 0)),
    (' transparent\n', (0, 0, 0, 0)),
    ('TransParent', (0, 0, 0, 0)),
    ('currentColor', 'currentColor'),
    ('CURRENTcolor', 'currentColor'),
    ('current_Color', None),

    ('black', (0, 0, 0, 1)),
    ('white', (1, 1, 1, 1)),
    ('fuchsia', (1, 0, 1, 1)),
    ('cyan', (0, 1, 1, 1)),
    ('CyAn', (0, 1, 1, 1)),
    ('darkkhaki', (189 / 255., 183 / 255., 107 / 255., 1)),

    ('#', None),
    ('#f', None),
    ('#ff', None),
    ('#fff', (1, 1, 1, 1)),
    ('#ffg', None),
    ('#ffff', None),
    ('#fffff', None),
    ('#ffffff', (1, 1, 1, 1)),
    ('#fffffg', None),
    ('#fffffff', None),
    ('#ffffffff', None),
    ('#fffffffff', None),

    ('#cba987', (203 / 255., 169 / 255., 135 / 255., 1)),
    ('#CbA987', (203 / 255., 169 / 255., 135 / 255., 1)),
    ('#1122aA', (17 / 255., 255. / 34, 170 / 255., 1)),
    ('#12a', (17 / 255., 34 / 255., 170 / 255., 1)),

    ('rgb(203, 169, 135)', (203 / 255., 169 / 255., 135 / 255., 1)),
    ('RGB(255, 255, 255)', (1, 1, 1, 1)),
    ('rgB(0, 0, 0)', (0, 0, 0, 1)),
    ('rgB(0, 51, 255)', (0, .2, 1, 1)),
    ('rgb(0,51,255)', (0, .2, 1, 1)),
    ('rgb(0\t,  51 ,255)', (0, .2, 1, 1)),
    ('rgb(/* R */0, /* G */51, /* B */255)', (0, .2, 1, 1)),
    ('rgb(-51, 306, 0)', (-.2, 1.2, 0, 1)),  # out of 0..1 is allowed

    ('rgb(42%, 3%, 50%)', (.42, .03, .5, 1)),
    ('RGB(100%, 100%, 100%)', (1, 1, 1, 1)),
    ('rgB(0%, 0%, 0%)', (0, 0, 0, 1)),
    ('rgB(10%, 20%, 30%)', (.1, .2, .3, 1)),
    ('rgb(10%,20%,30%)', (.1, .2, .3, 1)),
    ('rgb(10%\t,  20% ,30%)', (.1, .2, .3, 1)),
    ('rgb(/* R */10%, /* G */20%, /* B */30%)', (.1, .2, .3, 1)),
    ('rgb(-12%, 110%, 1400%)', (-.12, 1.1, 14, 1)),  # out of 0..1 is allowed

    ('rgb(10%, 50%, 0)', None),
    ('rgb(255, 50%, 0%)', None),
    ('rgb(0, 0 0)', None),
    ('rgb(0, 0, 0deg)', None),
    ('rgb(0, 0, light)', None),
    ('rgb()', None),
    ('rgb(0)', None),
    ('rgb(0, 0)', None),
    ('rgb(0, 0, 0, 0)', None),
    ('rgb(0%)', None),
    ('rgb(0%, 0%)', None),
    ('rgb(0%, 0%, 0%, 0%)', None),
    ('rgb(0%, 0%, 0%, 0)', None),

    ('rgba(0, 0, 0, 0)', (0, 0, 0, 0)),
    ('rgba(203, 169, 135, 0.3)', (203 / 255., 169 / 255., 135 / 255., 0.3)),
    ('RGBA(255, 255, 255, 0)', (1, 1, 1, 0)),
    ('rgBA(0, 51, 255, 1)', (0, 0.2, 1, 1)),
    ('rgba(0, 51, 255, 1.1)', (0, 0.2, 1, 1)),
    ('rgba(0, 51, 255, 37)', (0, 0.2, 1, 1)),
    ('rgba(0, 51, 255, 0.42)', (0, 0.2, 1, 0.42)),
    ('rgba(0, 51, 255, 0)', (0, 0.2, 1, 0)),
    ('rgba(0, 51, 255, -0.1)', (0, 0.2, 1, 0)),
    ('rgba(0, 51, 255, -139)', (0, 0.2, 1, 0)),

    ('rgba(42%, 3%, 50%, 0.3)', (.42, .03, .5, 0.3)),
    ('RGBA(100%, 100%, 100%, 0)', (1, 1, 1, 0)),
    ('rgBA(0%, 20%, 100%, 1)', (0, 0.2, 1, 1)),
    ('rgba(0%, 20%, 100%, 1.1)', (0, 0.2, 1, 1)),
    ('rgba(0%, 20%, 100%, 37)', (0, 0.2, 1, 1)),
    ('rgba(0%, 20%, 100%, 0.42)', (0, 0.2, 1, 0.42)),
    ('rgba(0%, 20%, 100%, 0)', (0, 0.2, 1, 0)),
    ('rgba(0%, 20%, 100%, -0.1)', (0, 0.2, 1, 0)),
    ('rgba(0%, 20%, 100%, -139)', (0, 0.2, 1, 0)),

    ('rgba(255, 255, 255, 0%)', None),
    ('rgba(10%, 50%, 0, 1)', None),
    ('rgba(255, 50%, 0%, 1)', None),
    ('rgba(0, 0, 0 0)', None),
    ('rgba(0, 0, 0, 0deg)', None),
    ('rgba(0, 0, 0, light)', None),
    ('rgba()', None),
    ('rgba(0)', None),
    ('rgba(0, 0, 0)', None),
    ('rgba(0, 0, 0, 0, 0)', None),
    ('rgba(0%)', None),
    ('rgba(0%, 0%)', None),
    ('rgba(0%, 0%, 0%)', None),
    ('rgba(0%, 0%, 0%, 0%)', None),
    ('rgba(0%, 0%, 0%, 0%, 0%)', None),

    ('HSL(0, 0%, 0%)', (0, 0, 0, 1)),
    ('hsL(0, 100%, 50%)', (1, 0, 0, 1)),
    ('hsl(60, 100%, 37.5%)', (0.75, 0.75, 0, 1)),
    ('hsl(780, 100%, 37.5%)', (0.75, 0.75, 0, 1)),
    ('hsl(-300, 100%, 37.5%)', (0.75, 0.75, 0, 1)),
    ('hsl(300, 50%, 50%)', (0.75, 0.25, 0.75, 1)),

    ('hsl(10, 50%, 0)', None),
    ('hsl(50%, 50%, 0%)', None),
    ('hsl(0, 0% 0%)', None),
    ('hsl(30deg, 100%, 100%)', None),
    ('hsl(0, 0%, light)', None),
    ('hsl()', None),
    ('hsl(0)', None),
    ('hsl(0, 0%)', None),
    ('hsl(0, 0%, 0%, 0%)', None),

    ('HSLA(-300, 100%, 37.5%, 1)', (0.75, 0.75, 0, 1)),
    ('hsLA(-300, 100%, 37.5%, 12)', (0.75, 0.75, 0, 1)),
    ('hsla(-300, 100%, 37.5%, 0.2)', (0.75, 0.75, 0, .2)),
    ('hsla(-300, 100%, 37.5%, 0)', (0.75, 0.75, 0, 0)),
    ('hsla(-300, 100%, 37.5%, -3)', (0.75, 0.75, 0, 0)),

    ('hsla(10, 50%, 0, 1)', None),
    ('hsla(50%, 50%, 0%, 1)', None),
    ('hsla(0, 0% 0%, 1)', None),
    ('hsla(30deg, 100%, 100%, 1)', None),
    ('hsla(0, 0%, light, 1)', None),
    ('hsla()', None),
    ('hsla(0)', None),
    ('hsla(0, 0%)', None),
    ('hsla(0, 0%, 0%, 50%)', None),
    ('hsla(0, 0%, 0%, 1, 0%)', None),

    ('cmyk(0, 0, 0, 0)', None),
])
def test_color(css_source, expected_result):
    result = parse_color_string(css_source)
    if isinstance(result, tuple):
        for got, expected in zip(result, expected_result):
            # Compensate for floating point errors:
            assert abs(got - expected) < 1e-10
        for i, attr in enumerate(['red', 'green', 'blue', 'alpha']):
            assert getattr(result, attr) == result[i]
    else:
        assert result == expected_result
dataset/ETHPy150Open FichteFoll/CSScheme/tinycsscheme/tinycss/tests/test_color3.py/test_color/swapped operands of `/`