Skip to content

Commit 18f3302

Browse files
committed
Update test to accommodate change in error and use SelectorSyntaxError
1 parent b2d2863 commit 18f3302

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

soupsieve/css_parser.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -655,9 +655,11 @@ def parse_pseudo_class(
655655
m.start(0)
656656
)
657657
else:
658-
raise ValueError(
658+
raise SelectorSyntaxError(
659659
f"'{pseudo}' was detected as a pseudo-class and is either unsupported or invalid. "
660-
"If the syntax was not intended to be recognized as a pseudo-class, please escape the colon."
660+
"If the syntax was not intended to be recognized as a pseudo-class, please escape the colon.",
661+
self.pattern,
662+
m.start(0)
661663
)
662664

663665
return has_selector, is_html
+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Test general pseudo-class cases."""
22
from .. import util
3+
from soupsieve import SelectorSyntaxError
34

45

56
class TestPseudoClass(util.TestCase):
@@ -8,9 +9,9 @@ class TestPseudoClass(util.TestCase):
89
def test_pseudo_class_not_implemented(self):
910
"""Test pseudo-class that is not implemented."""
1011

11-
self.assert_raises(':not-implemented', NotImplementedError)
12+
self.assert_raises(':not-implemented', SelectorSyntaxError)
1213

1314
def test_unrecognized_pseudo(self):
1415
"""Test unrecognized pseudo class."""
1516

16-
self.assert_raises(':before', NotImplementedError)
17+
self.assert_raises(':before', SelectorSyntaxError)

0 commit comments

Comments
 (0)