@@ -38,30 +38,31 @@ def test_css_parse_normalisation(name, norm, abnorm):
38
38
39
39
40
40
@pytest .mark .parametrize (
41
- "invalid_css,remainder" ,
41
+ "invalid_css,remainder,msg " ,
42
42
[
43
43
# No colon
44
- ("hello-world" , "" ),
45
- ("border-style: solid; hello-world" , "border-style: solid" ),
44
+ ("hello-world" , "" , "expected a colon" ),
45
+ ("border-style: solid; hello-world" , "border-style: solid" , "expected a colon" ),
46
46
(
47
47
"border-style: solid; hello-world; font-weight: bold" ,
48
48
"border-style: solid; font-weight: bold" ,
49
+ "expected a colon" ,
49
50
),
50
51
# Unclosed string fail
51
52
# Invalid size
52
- ("font-size: blah" , "font-size: 1em" ),
53
- ("font-size: 1a2b" , "font-size: 1em" ),
54
- ("font-size: 1e5pt" , "font-size: 1em" ),
55
- ("font-size: 1+6pt" , "font-size: 1em" ),
56
- ("font-size: 1unknownunit" , "font-size: 1em" ),
57
- ("font-size: 10" , "font-size: 1em" ),
58
- ("font-size: 10 pt" , "font-size: 1em" ),
53
+ ("font-size: blah" , "font-size: 1em" , "Unhandled size" ),
54
+ ("font-size: 1a2b" , "font-size: 1em" , "Unhandled size" ),
55
+ ("font-size: 1e5pt" , "font-size: 1em" , "Unhandled size" ),
56
+ ("font-size: 1+6pt" , "font-size: 1em" , "Unhandled size" ),
57
+ ("font-size: 1unknownunit" , "font-size: 1em" , "Unhandled size" ),
58
+ ("font-size: 10" , "font-size: 1em" , "Unhandled size" ),
59
+ ("font-size: 10 pt" , "font-size: 1em" , "Unhandled size" ),
59
60
# Too many args
60
- ("border-top: 1pt solid red green" , "border-top: 1pt solid green" ),
61
+ ("border-top: 1pt solid red green" , "border-top: 1pt solid green" , "Too many" ),
61
62
],
62
63
)
63
- def test_css_parse_invalid (invalid_css , remainder ):
64
- with tm .assert_produces_warning (CSSWarning ):
64
+ def test_css_parse_invalid (invalid_css , remainder , msg ):
65
+ with tm .assert_produces_warning (CSSWarning , match = msg ):
65
66
assert_same_resolution (invalid_css , remainder )
66
67
67
68
@@ -120,7 +121,7 @@ def test_css_side_shorthands(shorthand, expansions):
120
121
{top : "1pt" , right : "4pt" , bottom : "2pt" , left : "0pt" },
121
122
)
122
123
123
- with tm .assert_produces_warning (CSSWarning ):
124
+ with tm .assert_produces_warning (CSSWarning , match = "Could not expand" ):
124
125
assert_resolves (f"{ shorthand } : 1pt 1pt 1pt 1pt 1pt" , {})
125
126
126
127
0 commit comments