From 7d21694874e51a45a3ca03db1ad7c299e36834a7 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Sun, 28 Jun 2015 07:42:38 -0400 Subject: Raise a NotImplementedError whenever an unsupported CSS pseudoclass is used in select(). Previously some cases did not result in a NotImplementedError. --- bs4/tests/test_tree.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bs4/tests') diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py index 6ce2a07..7edf848 100644 --- a/bs4/tests/test_tree.py +++ b/bs4/tests/test_tree.py @@ -1828,6 +1828,14 @@ class TestSoupSelector(TreeTest): ('div[data-tag]', ['data1']) ) + def test_unsupported_pseudoclass(self): + self.assertRaises( + NotImplementedError, self.soup.select, "a:no-such-pseudoclass") + + self.assertRaises( + NotImplementedError, self.soup.select, "a:nth-of-type(a)") + + def test_nth_of_type(self): # Try to select first paragraph els = self.soup.select('div#inner p:nth-of-type(1)') -- cgit v1.2.3