diff options
author | Leonard Richardson <leonardr@segfault.org> | 2013-08-15 08:31:34 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2013-08-15 08:31:34 -0400 |
commit | dd223ac4913e461951b4325bb3826259d62d29a8 (patch) | |
tree | f4d56982df75243443d12514e54e8e012a26f95c /bs4/tests/test_tree.py | |
parent | 064439f3b2decfb55b4e118ac4d41851d13c4c6f (diff) |
Make sure the optimized find_all() ResultSets actually contain the right data.
Diffstat (limited to 'bs4/tests/test_tree.py')
-rw-r--r-- | bs4/tests/test_tree.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py index 1c2c93b..f8515c0 100644 --- a/bs4/tests/test_tree.py +++ b/bs4/tests/test_tree.py @@ -70,6 +70,16 @@ class TestFind(TreeTest): soup = self.soup(u'<h1>Räksmörgås</h1>') self.assertEqual(soup.find(text=u'Räksmörgås'), u'Räksmörgås') + def test_find_everything(self): + """Test an optimization that finds all tags.""" + soup = self.soup("<a>foo</a><b>bar</b>") + self.assertEqual(2, len(soup.find_all())) + + def test_find_everything_with_name(self): + """Test an optimization that finds all tags with a given name.""" + soup = self.soup("<a>foo</a><b>bar</b><a>baz</a>") + self.assertEqual(2, len(soup.find_all('a'))) + class TestFindAll(TreeTest): """Basic tests of the find_all() method.""" |