diff options
-rw-r--r-- | beautifulsoup/element.py | 5 | ||||
-rw-r--r-- | tests/test_tree.py | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/beautifulsoup/element.py b/beautifulsoup/element.py index 768618e..082c71b 100644 --- a/beautifulsoup/element.py +++ b/beautifulsoup/element.py @@ -164,15 +164,16 @@ class PageElement: def find_next(self, name=None, attrs={}, text=None, **kwargs): """Returns the first item that matches the given criteria and appears after this Tag in the document.""" - return self._findOne(self.find_allNext, name, attrs, text, **kwargs) + return self._findOne(self.find_all_next, name, attrs, text, **kwargs) findNext = find_next # Compatibility with BS3. - def find_allNext(self, name=None, attrs={}, text=None, limit=None, + def find_all_next(self, name=None, attrs={}, text=None, limit=None, **kwargs): """Returns all items that match the given criteria and appear after this Tag in the document.""" return self._find_all(name, attrs, text, limit, self.next_elements, **kwargs) + findAllNext = find_all_next # Compatibility with BS3. def find_nextSibling(self, name=None, attrs={}, text=None, **kwargs): """Returns the closest sibling to this Tag that matches the diff --git a/tests/test_tree.py b/tests/test_tree.py index e023cc7..86272bb 100644 --- a/tests/test_tree.py +++ b/tests/test_tree.py @@ -318,8 +318,8 @@ class TestNextOperations(ProximityTest): self.assertEquals(self.tree.next, None) def test_find_all_next(self): - self.assertSelects(self.start.find_allNext('b'), ["Two", "Three"]) - self.assertSelects(self.start.find_allNext(id=3), ["Three"]) + self.assertSelects(self.start.find_all_next('b'), ["Two", "Three"]) + self.assertSelects(self.start.find_all_next(id=3), ["Three"]) def test_find_next(self): self.assertEquals(self.start.find_next('b')['id'], '2') @@ -328,7 +328,7 @@ class TestNextOperations(ProximityTest): def test_find_next_for_text_element(self): text = self.tree.find(text="One") self.assertEquals(text.find_next("b").string, "Two") - self.assertSelects(text.find_allNext("b"), ["Two", "Three"]) + self.assertSelects(text.find_all_next("b"), ["Two", "Three"]) def test_next_generator(self): start = self.tree.find(text="Two") |