diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2012-03-01 09:06:25 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2012-03-01 09:06:25 -0500 |
commit | 4a5136d31bf07a7b28b58343f0c32e41d895e110 (patch) | |
tree | 271f5140137f4143774081ea92d872fc7f95bd92 /bs4/tests/test_tree.py | |
parent | 8bbc84dfc6324a32066b87cf3a78ce0eb719e289 (diff) |
Test that CSS selectors work within the tree as well as at the top level.
Diffstat (limited to 'bs4/tests/test_tree.py')
-rw-r--r-- | bs4/tests/test_tree.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py index bfc4218..3f32736 100644 --- a/bs4/tests/test_tree.py +++ b/bs4/tests/test_tree.py @@ -1301,7 +1301,7 @@ class TestNavigableStringSubclasses(SoupTest): self.assertEqual(soup.encode(), b"<!DOCTYPE foo>\n") -class TestSoupSelector(SoupTest): +class TestSoupSelector(TreeTest): HTML = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> @@ -1528,3 +1528,12 @@ class TestSoupSelector(SoupTest): ('[blah]', []), ('p[blah]', []), ) + + def test_select_on_element(self): + # Other tests operate on the tree; this operates on an element + # within the tree. + inner = self.soup.find("div", id="main") + selected = inner.select("div") + # The <div id="inner"> tag was selected. The <div id="footer"> + # tag was not. + self.assertSelectsIDs(selected, ['inner']) |