Python formatter.NullFormatter() Examples

The following are 15 code examples of formatter.NullFormatter(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module formatter , or try the search function .
Example #1
Source File: test_htmllib.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def test_decl_collection(self):
        # See SF patch #545300
        parser = DeclCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<html>
            <body>
            hallo
            <![if !supportEmptyParas]>&nbsp;<![endif]>
            </body>
            </html>
            """)
        parser.close()
        self.assertEqual(parser.get_decl_info(),
                         ["if !supportEmptyParas",
                          "endif"
                          ]) 
Example #2
Source File: test_htmllib.py    From BinderFilter with MIT License 6 votes vote down vote up
def test_decl_collection(self):
        # See SF patch #545300
        parser = DeclCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<html>
            <body>
            hallo
            <![if !supportEmptyParas]>&nbsp;<![endif]>
            </body>
            </html>
            """)
        parser.close()
        self.assertEqual(parser.get_decl_info(),
                         ["if !supportEmptyParas",
                          "endif"
                          ]) 
Example #3
Source File: test_htmllib.py    From oss-ftp with MIT License 6 votes vote down vote up
def test_decl_collection(self):
        # See SF patch #545300
        parser = DeclCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<html>
            <body>
            hallo
            <![if !supportEmptyParas]>&nbsp;<![endif]>
            </body>
            </html>
            """)
        parser.close()
        self.assertEqual(parser.get_decl_info(),
                         ["if !supportEmptyParas",
                          "endif"
                          ]) 
Example #4
Source File: test_htmllib.py    From gcblue with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def test_decl_collection(self):
        # See SF patch #545300
        parser = DeclCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<html>
            <body>
            hallo
            <![if !supportEmptyParas]>&nbsp;<![endif]>
            </body>
            </html>
            """)
        parser.close()
        self.assertEqual(parser.get_decl_info(),
                         ["if !supportEmptyParas",
                          "endif"
                          ]) 
Example #5
Source File: test_htmllib.py    From medicare-demo with Apache License 2.0 6 votes vote down vote up
def test_decl_collection(self):
        # See SF patch #545300
        parser = DeclCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<html>
            <body>
            hallo
            <![if !supportEmptyParas]>&nbsp;<![endif]>
            </body>
            </html>
            """)
        parser.close()
        self.assertEquals(parser.get_decl_info(),
                          ["if !supportEmptyParas",
                           "endif"
                           ]) 
Example #6
Source File: test_htmllib.py    From CTFCrackTools-V2 with GNU General Public License v3.0 6 votes vote down vote up
def test_decl_collection(self):
        # See SF patch #545300
        parser = DeclCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<html>
            <body>
            hallo
            <![if !supportEmptyParas]>&nbsp;<![endif]>
            </body>
            </html>
            """)
        parser.close()
        self.assertEqual(parser.get_decl_info(),
                         ["if !supportEmptyParas",
                          "endif"
                          ]) 
Example #7
Source File: test_htmllib.py    From CTFCrackTools with GNU General Public License v3.0 6 votes vote down vote up
def test_decl_collection(self):
        # See SF patch #545300
        parser = DeclCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<html>
            <body>
            hallo
            <![if !supportEmptyParas]>&nbsp;<![endif]>
            </body>
            </html>
            """)
        parser.close()
        self.assertEqual(parser.get_decl_info(),
                         ["if !supportEmptyParas",
                          "endif"
                          ]) 
Example #8
Source File: test_htmllib.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_anchor_collection(self):
        # See SF bug #467059.
        parser = AnchorCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<a href='http://foo.org/' name='splat'> </a>
            <a href='http://www.python.org/'> </a>
            <a name='frob'> </a>
            """)
        parser.close()
        self.assertEqual(parser.get_anchor_info(),
                         [('http://foo.org/', 'splat', ''),
                          ('http://www.python.org/', '', ''),
                          ('', 'frob', ''),
                          ]) 
Example #9
Source File: htmlutil.py    From closure-linter with Apache License 2.0 5 votes vote down vote up
def __init__(self):
    """Initialize a ScriptExtractor."""
    htmllib.HTMLParser.__init__(self, formatter.NullFormatter())
    self._in_script = False
    self._text = '' 
Example #10
Source File: test_htmllib.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_anchor_collection(self):
        # See SF bug #467059.
        parser = AnchorCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<a href='http://foo.org/' name='splat'> </a>
            <a href='http://www.python.org/'> </a>
            <a name='frob'> </a>
            """)
        parser.close()
        self.assertEqual(parser.get_anchor_info(),
                         [('http://foo.org/', 'splat', ''),
                          ('http://www.python.org/', '', ''),
                          ('', 'frob', ''),
                          ]) 
Example #11
Source File: test_htmllib.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_anchor_collection(self):
        # See SF bug #467059.
        parser = AnchorCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<a href='http://foo.org/' name='splat'> </a>
            <a href='http://www.python.org/'> </a>
            <a name='frob'> </a>
            """)
        parser.close()
        self.assertEqual(parser.get_anchor_info(),
                         [('http://foo.org/', 'splat', ''),
                          ('http://www.python.org/', '', ''),
                          ('', 'frob', ''),
                          ]) 
Example #12
Source File: test_htmllib.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_anchor_collection(self):
        # See SF bug #467059.
        parser = AnchorCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<a href='http://foo.org/' name='splat'> </a>
            <a href='http://www.python.org/'> </a>
            <a name='frob'> </a>
            """)
        parser.close()
        self.assertEqual(parser.get_anchor_info(),
                         [('http://foo.org/', 'splat', ''),
                          ('http://www.python.org/', '', ''),
                          ('', 'frob', ''),
                          ]) 
Example #13
Source File: test_htmllib.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_anchor_collection(self):
        # See SF bug #467059.
        parser = AnchorCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<a href='http://foo.org/' name='splat'> </a>
            <a href='http://www.python.org/'> </a>
            <a name='frob'> </a>
            """)
        parser.close()
        self.assertEquals(parser.get_anchor_info(),
                          [('http://foo.org/', 'splat', ''),
                           ('http://www.python.org/', '', ''),
                           ('', 'frob', ''),
                           ]) 
Example #14
Source File: test_htmllib.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_anchor_collection(self):
        # See SF bug #467059.
        parser = AnchorCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<a href='http://foo.org/' name='splat'> </a>
            <a href='http://www.python.org/'> </a>
            <a name='frob'> </a>
            """)
        parser.close()
        self.assertEqual(parser.get_anchor_info(),
                         [('http://foo.org/', 'splat', ''),
                          ('http://www.python.org/', '', ''),
                          ('', 'frob', ''),
                          ]) 
Example #15
Source File: test_htmllib.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_anchor_collection(self):
        # See SF bug #467059.
        parser = AnchorCollector(formatter.NullFormatter(), verbose=1)
        parser.feed(
            """<a href='http://foo.org/' name='splat'> </a>
            <a href='http://www.python.org/'> </a>
            <a name='frob'> </a>
            """)
        parser.close()
        self.assertEqual(parser.get_anchor_info(),
                         [('http://foo.org/', 'splat', ''),
                          ('http://www.python.org/', '', ''),
                          ('', 'frob', ''),
                          ])