summaryrefslogtreecommitdiff
path: root/bs4
diff options
context:
space:
mode:
Diffstat (limited to 'bs4')
-rw-r--r--bs4/element.py5
-rw-r--r--bs4/tests/test_tree.py3
2 files changed, 7 insertions, 1 deletions
diff --git a/bs4/element.py b/bs4/element.py
index 95b6735..454d34b 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -1,3 +1,4 @@
+from pdb import set_trace
import collections
import re
import sys
@@ -498,6 +499,10 @@ class PageElement(object):
def _find_all(self, name, attrs, text, limit, generator, **kwargs):
"Iterates over a generator looking for things that match."
+ if text is None and 'string' in kwargs:
+ text = kwargs['string']
+ del kwargs['string']
+
if isinstance(name, SoupStrainer):
strainer = name
else:
diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py
index 0bd4713..9e2982a 100644
--- a/bs4/tests/test_tree.py
+++ b/bs4/tests/test_tree.py
@@ -70,7 +70,7 @@ class TestFind(TreeTest):
def test_unicode_text_find(self):
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')
+ self.assertEqual(soup.find(string=u'Räksmörgås'), u'Räksmörgås')
def test_unicode_attribute_find(self):
soup = self.soup(u'<h1 id="Räksmörgås">here it is</h1>')
@@ -95,6 +95,7 @@ class TestFindAll(TreeTest):
"""You can search the tree for text nodes."""
soup = self.soup("<html>Foo<b>bar</b>\xbb</html>")
# Exact match.
+ self.assertEqual(soup.find_all(string="bar"), [u"bar"])
self.assertEqual(soup.find_all(text="bar"), [u"bar"])
# Match any of a number of strings.
self.assertEqual(