diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-18 07:42:43 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-18 07:42:43 -0500 |
commit | 662ec109acc656b1607b8464d3ef85f5d1feec4c (patch) | |
tree | a54b09e99bb5aeaf361e2ebc9feda15516c7eaca | |
parent | ca1558a5477b27815a20ac248b3ac8a10084c5ab (diff) |
Fixed test failures that were masked by the compatibility methods.
-rw-r--r-- | beautifulsoup/element.py | 2 | ||||
-rw-r--r-- | tests/test_tree.py | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/beautifulsoup/element.py b/beautifulsoup/element.py index 31e8fce..726f2e2 100644 --- a/beautifulsoup/element.py +++ b/beautifulsoup/element.py @@ -313,7 +313,7 @@ class PageElement: yield i # Old non-property versions of the generators, for backwards - # compatibility. + # compatibility with BS3. def nextGenerator(self): return self.next_elements diff --git a/tests/test_tree.py b/tests/test_tree.py index 09bdb87..e424e0b 100644 --- a/tests/test_tree.py +++ b/tests/test_tree.py @@ -286,7 +286,7 @@ class TestParentOperations(TreeTest): self.assertEquals(text.find_parent('ul')['id'], 'bottom') def test_parent_generator(self): - parents = [parent['id'] for parent in self.start.parentGenerator() + parents = [parent['id'] for parent in self.start.parents if parent is not None and parent.has_key('id')] self.assertEquals(parents, ['bottom', 'middle', 'top']) @@ -332,7 +332,7 @@ class TestNextOperations(ProximityTest): def test_next_generator(self): start = self.tree.find(text="Two") - successors = [node for node in start.nextGenerator()] + successors = [node for node in start.next_elements] # There are two successors: the final <b> tag and its text contents. # Then we go off the end. tag, contents, none = successors @@ -340,7 +340,7 @@ class TestNextOperations(ProximityTest): self.assertEquals(contents, "Three") self.assertEquals(none, None) - # XXX Should nextGenerator really return None? Seems like it + # XXX Should next_elements really return None? Seems like it # should just stop. @@ -373,18 +373,18 @@ class TestPreviousOperations(ProximityTest): self.assertSelects(self.end.find_all_previous(id=1), ["One"]) def test_find_previous(self): - self.assertEquals(self.end.findPrevious('b')['id'], '3') - self.assertEquals(self.end.findPrevious(text="One"), "One") + self.assertEquals(self.end.find_previous('b')['id'], '3') + self.assertEquals(self.end.find_previous(text="One"), "One") def test_find_previous_for_text_element(self): text = self.tree.find(text="Three") - self.assertEquals(text.findPrevious("b").string, "Three") + self.assertEquals(text.find_previous("b").string, "Three") self.assertSelects( text.find_all_previous("b"), ["Three", "Two", "One"]) def test_previous_generator(self): start = self.tree.find(text="One") - predecessors = [node for node in start.previousGenerator()] + predecessors = [node for node in start.previous_elements] # There are four predecessors: the <b> tag containing "One" # the <body> tag, the <head> tag, and the <html> tag. Then we |