@@ -270,9 +270,9 @@ def specificity(css):
270270 assert specificity (':not(:empty)' ) == (0 , 1 , 0 )
271271 assert specificity (':not(#foo)' ) == (1 , 0 , 0 )
272272
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 )
276276
277277 assert specificity (':is(.foo, #bar)' ) == (1 , 0 , 0 )
278278 assert specificity (':is(:hover, :visited)' ) == (0 , 1 , 0 )
@@ -311,8 +311,8 @@ def css2css(css, res=None):
311311 css2css (':not(*[foo])' , ':not([foo])' )
312312 css2css (':not(:empty)' )
313313 css2css (':not(#foo)' )
314- css2css (' :has(*)' )
315- css2css (' :has(foo)' )
314+ css2css (" :has(*)" )
315+ css2css (" :has(foo)" )
316316 css2css (':is(#bar, .foo)' )
317317 css2css (':is(:focused, :visited)' )
318318 css2css ('foo:empty' )
@@ -511,10 +511,14 @@ def xpath(css):
511511 "e[not(count(preceding-sibling::*) mod 2 = 0)]" )
512512 assert xpath ('e:nOT(*)' ) == (
513513 "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+ )
518522 assert xpath ('e f' ) == (
519523 "e/descendant-or-self::*/f" )
520524 assert xpath ('e > f' ) == (
@@ -886,7 +890,7 @@ def pcss(main, *selectors, **kwargs):
886890 assert pcss ('ol :Not(li[class])' ) == [
887891 'first-li' , 'second-li' , 'li-div' ,
888892 'fifth-li' , 'sixth-li' , 'seventh-li' ]
889- assert pcss (' ol:has(div)' ) == [' first-ol' ]
893+ assert pcss (" ol:has(div)" ) == [" first-ol" ]
890894 assert pcss (':is(#first-li, #second-li)' ) == [
891895 'first-li' , 'second-li' ]
892896 assert pcss ('a:is(#name-anchor, #tag-anchor)' ) == [
0 commit comments