Did I find the right examples for you? yes no

All Samples(342)  |  Call(186)  |  Derive(0)  |  Import(156)
Encapsulates a number of ways of matching a markup element (tag or
text).

src/r/w/rwet-examples-HEAD/web/bs4/tests/test_tree.py   rwet-examples(Download)
    HTMLParserTreeBuilder,
)
from bs4.element import (
    CData,
    Doctype,
    def test_find_all_by_tag_strainer(self):
        self.assertSelects(
            self.tree.find_all(SoupStrainer('a')),
            ['First tag.', 'Nested tag.'])
 
                         <a id="second">Non-match.</a>""")
 
        strainer = SoupStrainer(attrs={'id' : 'first'})
        self.assertSelects(tree.find_all(strainer), ['Match.'])
 
        # meta tag got filtered out by the strainer. This test makes
        # sure that doesn't happen.
        strainer = SoupStrainer('pre')
        soup = self.soup(markup, parse_only=strainer)
        self.assertEqual(soup.contents[0].name, 'pre')

src/r/w/rwet-examples-HEAD/web/bs4/tests/test_soup.py   rwet-examples(Download)
    BeautifulStoneSoup,
)
from bs4.element import (
    SoupStrainer,
    NamespacedAttribute,
    def test_parse_with_soupstrainer(self):
        markup = "No<b>Yes</b><a>No<b>Yes <c>Yes</c></b>"
        strainer = SoupStrainer("b")
        soup = self.soup(markup, parse_only=strainer)
        self.assertEqual(soup.encode(), b"<b>Yes</b><b>Yes <c>Yes</c></b>")

src/r/w/rwet-examples-HEAD/web/bs4/testing.py   rwet-examples(Download)
from unittest import TestCase
from bs4 import BeautifulSoup
from bs4.element import (
    Comment,
    Doctype,
    def test_soupstrainer(self):
        """Parsers should be able to work with SoupStrainers."""
        strainer = SoupStrainer("b")
        soup = self.soup("A <b>bold</b> <meta/> <i>statement</i>",
                         parse_only=strainer)

src/r/w/rwet-examples-HEAD/web/bs4/tests/test_html5lib.py   rwet-examples(Download)
except ImportError, e:
    HTML5LIB_PRESENT = False
from bs4.element import SoupStrainer
from bs4.testing import (
    HTML5TreeBuilderSmokeTest,
    def test_soupstrainer(self):
        # The html5lib tree builder does not support SoupStrainers.
        strainer = SoupStrainer("b")
        markup = "<p>A <b>bold</b> statement.</p>"
        with warnings.catch_warnings(record=True) as w:

src/r/w/rwet-examples-HEAD/web/bs4/tests/test_lxml.py   rwet-examples(Download)
    BeautifulStoneSoup,
    )
from bs4.element import Comment, Doctype, SoupStrainer
from bs4.testing import skipIf
from bs4.tests import test_htmlparser

src/h/u/hue-HEAD/desktop/core/ext-py/requests-2.0.0/requests/packages/bs4/tests/test_tree.py   hue(Download)
    HTMLParserTreeBuilder,
)
from bs4.element import (
    CData,
    Comment,
    def test_find_all_by_tag_strainer(self):
        self.assertSelects(
            self.tree.find_all(SoupStrainer('a')),
            ['First tag.', 'Nested tag.'])
 
                         <a id="second">Non-match.</a>""")
 
        strainer = SoupStrainer(attrs={'id' : 'first'})
        self.assertSelects(tree.find_all(strainer), ['Match.'])
 
        # meta tag got filtered out by the strainer. This test makes
        # sure that doesn't happen.
        strainer = SoupStrainer('pre')
        soup = self.soup(markup, parse_only=strainer)
        self.assertEqual(soup.contents[0].name, 'pre')

src/x/b/xbmctorrent-HEAD/resources/site-packages/bs4/tests/test_tree.py   xbmctorrent(Download)
    HTMLParserTreeBuilder,
)
from bs4.element import (
    CData,
    Comment,
    def test_find_all_by_tag_strainer(self):
        self.assertSelects(
            self.tree.find_all(SoupStrainer('a')),
            ['First tag.', 'Nested tag.'])
 
                         <a id="second">Non-match.</a>""")
 
        strainer = SoupStrainer(attrs={'id' : 'first'})
        self.assertSelects(tree.find_all(strainer), ['Match.'])
 
        # meta tag got filtered out by the strainer. This test makes
        # sure that doesn't happen.
        strainer = SoupStrainer('pre')
        soup = self.soup(markup, parse_only=strainer)
        self.assertEqual(soup.contents[0].name, 'pre')

src/a/l/alfred-workflows-scientific-HEAD/reference-importer/src/bs4/tests/test_tree.py   alfred-workflows-scientific(Download)
    HTMLParserTreeBuilder,
)
from bs4.element import (
    CData,
    Doctype,
    def test_find_all_by_tag_strainer(self):
        self.assertSelects(
            self.tree.find_all(SoupStrainer('a')),
            ['First tag.', 'Nested tag.'])
 
                         <a id="second">Non-match.</a>""")
 
        strainer = SoupStrainer(attrs={'id' : 'first'})
        self.assertSelects(tree.find_all(strainer), ['Match.'])
 
        # meta tag got filtered out by the strainer. This test makes
        # sure that doesn't happen.
        strainer = SoupStrainer('pre')
        soup = self.soup(markup, parse_only=strainer)
        self.assertEqual(soup.contents[0].name, 'pre')

src/a/l/alfred-workflows-scientific-HEAD/numpy-search/src/bs4/tests/test_tree.py   alfred-workflows-scientific(Download)
    HTMLParserTreeBuilder,
)
from bs4.element import (
    CData,
    Doctype,
    def test_find_all_by_tag_strainer(self):
        self.assertSelects(
            self.tree.find_all(SoupStrainer('a')),
            ['First tag.', 'Nested tag.'])
 
                         <a id="second">Non-match.</a>""")
 
        strainer = SoupStrainer(attrs={'id' : 'first'})
        self.assertSelects(tree.find_all(strainer), ['Match.'])
 
        # meta tag got filtered out by the strainer. This test makes
        # sure that doesn't happen.
        strainer = SoupStrainer('pre')
        soup = self.soup(markup, parse_only=strainer)
        self.assertEqual(soup.contents[0].name, 'pre')

src/a/l/AlfredWorkflow.com-HEAD/Sources/Workflows/AlfredWorkflow.com-Search/bs4/tests/test_tree.py   AlfredWorkflow.com(Download)
    HTMLParserTreeBuilder,
)
from bs4.element import (
    CData,
    Doctype,
    def test_find_all_by_tag_strainer(self):
        self.assertSelects(
            self.tree.find_all(SoupStrainer('a')),
            ['First tag.', 'Nested tag.'])
 
                         <a id="second">Non-match.</a>""")
 
        strainer = SoupStrainer(attrs={'id' : 'first'})
        self.assertSelects(tree.find_all(strainer), ['Match.'])
 
        # meta tag got filtered out by the strainer. This test makes
        # sure that doesn't happen.
        strainer = SoupStrainer('pre')
        soup = self.soup(markup, parse_only=strainer)
        self.assertEqual(soup.contents[0].name, 'pre')

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next