diff options
Diffstat (limited to 'bs4')
-rw-r--r-- | bs4/element.py | 2 | ||||
-rw-r--r-- | bs4/tests/test_tree.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/bs4/element.py b/bs4/element.py index 584e171..2851a75 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -838,7 +838,7 @@ class Tag(PageElement): """Calling a tag like a function is the same as calling its find_all() method. Eg. tag('a') returns a list of all the A tags found within this tag.""" - return self.find_all(args, kwargs) + return self.find_all(*args, **kwargs) def __getattr__(self, tag): #print "Getattr %s.%s" % (self.__class__, tag) diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py index 3f32736..6d22448 100644 --- a/bs4/tests/test_tree.py +++ b/bs4/tests/test_tree.py @@ -99,6 +99,11 @@ class TestFindAll(TreeTest): self.assertSelects( soup.find_all('a', limit=0), ["1", "2", "3", "4", "5"]) + def test_calling_a_tag_is_calling_findall(self): + soup = self.soup("<a>1</a><b>2<a id='foo'>3</a></b>") + self.assertSelects(soup('a', limit=1), ["1"]) + self.assertSelects(soup.b(id="foo"), ["3"]) + class TestFindAllBasicNamespaces(TreeTest): def test_find_by_namespaced_name(self): |