summaryrefslogtreecommitdiff
path: root/bs4/tests/test_tree.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2012-05-24 11:59:10 -0400
committerLeonard Richardson <leonardr@segfault.org>2012-05-24 11:59:10 -0400
commit49aa4dd243353f7d0f25d7c5ea51ba3344110a47 (patch)
treed38b3cde2a5321d5acc396ffbfed01d74237a4d4 /bs4/tests/test_tree.py
parent44a7d024d824ccf557f67c81503131f824e3b109 (diff)
Fixed the inability to search for non-ASCII attribute
values. [bug=1003974] This caused a major refactoring of the search code. All the tests pass, but it's possible that some searches will behave differently.
Diffstat (limited to 'bs4/tests/test_tree.py')
-rw-r--r--bs4/tests/test_tree.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py
index 1bb479e..cc573ed 100644
--- a/bs4/tests/test_tree.py
+++ b/bs4/tests/test_tree.py
@@ -104,6 +104,16 @@ class TestFindAll(TreeTest):
self.assertSelects(soup('a', limit=1), ["1"])
self.assertSelects(soup.b(id="foo"), ["3"])
+ def test_find_all_with_self_referential_data_structure_does_not_cause_infinite_recursion(self):
+ soup = self.soup("<a></a>")
+ # Create a self-referential list.
+ l = []
+ l.append(l)
+
+ # Without special code in _normalize_search_value, this would cause infinite
+ # recursion.
+ self.assertEqual([], soup.find_all(l))
+
class TestFindAllBasicNamespaces(TreeTest):
def test_find_by_namespaced_name(self):