Skip to content

Commit c3f7a92

Browse files
committed
Readd removed tests (oopsi)
1 parent 1e47dd1 commit c3f7a92

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test_tinycss2.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,19 @@ def test_color_hexadecimal_3(input):
224224
return result
225225

226226

227+
@json_test(filename='color_hexadecimal_3.json')
228+
def test_color_hexadecimal_3_with_4(input):
229+
if not (color := parse_color4(input)):
230+
return None
231+
(*coordinates, alpha) = color
232+
result = f'rgb{"a" if alpha != 1 else ""}('
233+
result += f'{", ".join(_number(coordinate * 255) for coordinate in coordinates)}'
234+
if alpha != 1:
235+
result += f', {_number(alpha)}'
236+
result += ')'
237+
return result
238+
239+
227240
@json_test()
228241
def test_color_hexadecimal_4(input):
229242
if not (color := parse_color4(input)):
@@ -538,6 +551,22 @@ def test_color_lch_4_with_5(input):
538551
return result
539552

540553

554+
@json_test()
555+
def test_color_oklch_4(input):
556+
if not (color := parse_color4(input)):
557+
return None
558+
elif isinstance(color, str):
559+
return color
560+
assert color.space == 'oklch'
561+
(*coordinates, alpha) = color
562+
result = f'{color.space}('
563+
result += f'{" ".join(_number(coordinate) for coordinate in coordinates)}'
564+
if alpha != 1:
565+
result += f' / {_number(alpha)}'
566+
result += ')'
567+
return result
568+
569+
541570
@json_test(filename='color_oklch_4.json')
542571
def test_color_oklch_4_with_5(input):
543572
if not (color := parse_color5(input)):

0 commit comments

Comments
 (0)