@@ -270,9 +270,9 @@ def specificity(css):
270
270
assert specificity (':not(:empty)' ) == (0 , 1 , 0 )
271
271
assert specificity (':not(#foo)' ) == (1 , 0 , 0 )
272
272
273
- assert specificity (' :has(*)' ) == (0 , 0 , 0 )
274
- assert specificity (' :has(foo)' ) == (0 , 0 , 1 )
275
- assert specificity (' :has(> foo)' ) == (0 , 0 , 1 )
273
+ assert specificity (" :has(*)" ) == (0 , 0 , 0 )
274
+ assert specificity (" :has(foo)" ) == (0 , 0 , 1 )
275
+ assert specificity (" :has(> foo)" ) == (0 , 0 , 1 )
276
276
277
277
assert specificity (':is(.foo, #bar)' ) == (1 , 0 , 0 )
278
278
assert specificity (':is(:hover, :visited)' ) == (0 , 1 , 0 )
@@ -311,8 +311,8 @@ def css2css(css, res=None):
311
311
css2css (':not(*[foo])' , ':not([foo])' )
312
312
css2css (':not(:empty)' )
313
313
css2css (':not(#foo)' )
314
- css2css (' :has(*)' )
315
- css2css (' :has(foo)' )
314
+ css2css (" :has(*)" )
315
+ css2css (" :has(foo)" )
316
316
css2css (':is(#bar, .foo)' )
317
317
css2css (':is(:focused, :visited)' )
318
318
css2css ('foo:empty' )
@@ -511,10 +511,14 @@ def xpath(css):
511
511
"e[not(count(preceding-sibling::*) mod 2 = 0)]" )
512
512
assert xpath ('e:nOT(*)' ) == (
513
513
"e[0]" ) # never matches
514
- assert xpath ('e:has(> f)' ) == 'e[./f]'
515
- assert xpath ('e:has(f)' ) == 'e[descendant::f]'
516
- assert xpath ('e:has(~ f)' ) == 'e[following-sibling::f]'
517
- assert xpath ('e:has(+ f)' ) == "e/following-sibling::*[(name() = 'f') and (position() = 1)]/preceding-sibling::*[(name() = 'e') and (position() = 1)]"
514
+ assert xpath ("e:has(> f)" ) == "e[./f]"
515
+ assert xpath ("e:has(f)" ) == "e[descendant::f]"
516
+ assert xpath ("e:has(~ f)" ) == "e[following-sibling::f]"
517
+ assert (
518
+ xpath ("e:has(+ f)" )
519
+ == "e/following-sibling::*[(name() = 'f') and (position() = 1)]"
520
+ "/preceding-sibling::*[(name() = 'e') and (position() = 1)]"
521
+ )
518
522
assert xpath ('e f' ) == (
519
523
"e/descendant-or-self::*/f" )
520
524
assert xpath ('e > f' ) == (
@@ -886,7 +890,7 @@ def pcss(main, *selectors, **kwargs):
886
890
assert pcss ('ol :Not(li[class])' ) == [
887
891
'first-li' , 'second-li' , 'li-div' ,
888
892
'fifth-li' , 'sixth-li' , 'seventh-li' ]
889
- assert pcss (' ol:has(div)' ) == [' first-ol' ]
893
+ assert pcss (" ol:has(div)" ) == [" first-ol" ]
890
894
assert pcss (':is(#first-li, #second-li)' ) == [
891
895
'first-li' , 'second-li' ]
892
896
assert pcss ('a:is(#name-anchor, #tag-anchor)' ) == [
0 commit comments