File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -452,7 +452,8 @@ def parse_simple_selector(stream, inside_negation=False):
452
452
continue
453
453
if stream .peek () != ('DELIM' , '(' ):
454
454
result = Pseudo (result , ident )
455
- if result .ident == 'scope' :
455
+ if result .ident == 'scope' and repr (
456
+ result ) == 'Pseudo[Element[*]:scope]' :
456
457
if not (len (stream .used ) == 2 or
457
458
(len (stream .used ) == 3
458
459
and stream .used [0 ].type == 'S' )):
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class TestCssselect(unittest.TestCase):
42
42
def test_tokenizer (self ):
43
43
tokens = [
44
44
_unicode (item ) for item in tokenize (
45
- u (r'E\ é > f [a~="y\"x"]:nth(/* fu /]* */-3.7)< ' ))]
45
+ u (r'E\ é > f [a~="y\"x"]:nth(/* fu /]* */-3.7)' ))]
46
46
assert tokens == [
47
47
u ("<IDENT 'E é' at 0>" ),
48
48
"<S ' ' at 4>" ,
@@ -61,8 +61,7 @@ def test_tokenizer(self):
61
61
"<DELIM '(' at 24>" ,
62
62
"<NUMBER '-3.7' at 37>" ,
63
63
"<DELIM ')' at 41>" ,
64
- "<DELIM '<' at 42>" ,
65
- "<EOF at 43>" ,
64
+ "<EOF at 42>" ,
66
65
]
67
66
68
67
def test_parser (self ):
@@ -162,7 +161,6 @@ def parse_many(first, *others):
162
161
'Hash[Element[*]#foo]] <followed> Hash[Element[*]#bar]]'
163
162
]
164
163
165
- # TODO ADD TESTS
166
164
def test_pseudo_elements (self ):
167
165
def parse_pseudo (css ):
168
166
result = []
@@ -334,6 +332,9 @@ def get_error(css):
334
332
assert get_error (':scope > div :scope header' ) == (
335
333
'Got immediate child pseudo-element ":scope" not at the start of a selector'
336
334
)
335
+ assert get_error ('div :scope header' ) == (
336
+ 'Got immediate child pseudo-element ":scope" not at the start of a selector'
337
+ )
337
338
assert get_error ('> div p' ) == ("Expected selector, got <DELIM '>' at 0>" )
338
339
339
340
def test_translation (self ):
You can’t perform that action at this time.
0 commit comments