diff options
author | Leonard Richardson <leonardr@segfault.org> | 2020-04-12 14:26:55 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2020-04-12 14:26:55 -0400 |
commit | c39b3d727006259d7933f468cef7cb1ea9ab6bba (patch) | |
tree | a13595c4c54da7ab017b3a37151c8a2a4f15566d | |
parent | fed905a6dcad1d414a21fcb98d9bc9e3a4aaf648 (diff) |
Fixed test failures when run against soupselect 2.0. Patch by Tomáš
Chvátal. [bug=1872279]
-rw-r--r-- | CHANGELOG | 8 | ||||
-rw-r--r-- | bs4/tests/test_tree.py | 11 |
2 files changed, 14 insertions, 5 deletions
@@ -1,3 +1,11 @@ += 4.9.1 (unreleased) + +* The new NavigableString subclasses (Stylesheet, Script, and + TemplateString) can now be imported directly from the bs4 package. + +* Fixed test failures when run against soupselect 2.0. Patch by Tomáš + Chvátal. [bug=1872279] + = 4.9.0 (20200405) * Added PageElement.decomposed, a new property which lets you diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py index 7ecab9e..7981130 100644 --- a/bs4/tests/test_tree.py +++ b/bs4/tests/test_tree.py @@ -37,6 +37,7 @@ from bs4.testing import ( SoupTest, skipIf, ) +from soupsieve import SelectorSyntaxError XML_BUILDER_PRESENT = (builder_registry.lookup("xml") is not None) LXML_PRESENT = (builder_registry.lookup("lxml") is not None) @@ -2018,7 +2019,7 @@ class TestSoupSelector(TreeTest): self.assertEqual(len(self.soup.select('del')), 0) def test_invalid_tag(self): - self.assertRaises(SyntaxError, self.soup.select, 'tag%t') + self.assertRaises(SelectorSyntaxError, self.soup.select, 'tag%t') def test_select_dashed_tag_ids(self): self.assertSelects('custom-dashed-tag', ['dash1', 'dash2']) @@ -2209,7 +2210,7 @@ class TestSoupSelector(TreeTest): NotImplementedError, self.soup.select, "a:no-such-pseudoclass") self.assertRaises( - SyntaxError, self.soup.select, "a:nth-of-type(a)") + SelectorSyntaxError, self.soup.select, "a:nth-of-type(a)") def test_nth_of_type(self): # Try to select first paragraph @@ -2265,7 +2266,7 @@ class TestSoupSelector(TreeTest): self.assertEqual([], self.soup.select('#inner ~ h2')) def test_dangling_combinator(self): - self.assertRaises(SyntaxError, self.soup.select, 'h1 >') + self.assertRaises(SelectorSyntaxError, self.soup.select, 'h1 >') def test_sibling_combinator_wont_select_same_tag_twice(self): self.assertSelects('p[lang] ~ p', ['lang-en-gb', 'lang-en-us', 'lang-fr']) @@ -2296,8 +2297,8 @@ class TestSoupSelector(TreeTest): self.assertSelects('div x,y, z', ['xid', 'yid', 'zida', 'zidb', 'zidab', 'zidac']) def test_invalid_multiple_select(self): - self.assertRaises(SyntaxError, self.soup.select, ',x, y') - self.assertRaises(SyntaxError, self.soup.select, 'x,,y') + self.assertRaises(SelectorSyntaxError, self.soup.select, ',x, y') + self.assertRaises(SelectorSyntaxError, self.soup.select, 'x,,y') def test_multiple_select_attrs(self): self.assertSelects('p[lang=en], p[lang=en-gb]', ['lang-en', 'lang-en-gb']) |