Exemple #1
0
 def test_bold_italic(self):
     snippet = '''<b>Bold</b> or <i>Italic</i>'''
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['<b>Bold</b> or <i>Italic</i>'])
     snippet = '''<strong>Bold</strong> or <em>Italic</em>'''
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['<strong>Bold</strong> or <em>Italic</em>'])
 def test_bold_italic(self):
     snippet = '''<b>Bold</b> or <i>Italic</i>'''
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['<b>Bold</b> or <i>Italic</i>'])
     snippet = '''<strong>Bold</strong> or <em>Italic</em>'''
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['<strong>Bold</strong> or <em>Italic</em>'])
Exemple #3
0
 def test_br(self):
     snippet = dedent('''
         <p>One paragraph<br/>Another line</p>''')
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['One paragraph', 'Another line'])
     snippet = '''<p>One paragraph<br>    <br></p>'''
     self.assertEqual(buildHTMLParagraphs(snippet), ['One paragraph'])
Exemple #4
0
 def test_entities(self):
     snippet = '''<p>One &amp; Two</p>'''
     self.assertEqual(buildHTMLParagraphs(snippet), ['One &amp; Two'])
     snippet = '''<p>One&nbsp;&lt;&nbsp;Two</p>'''
     self.assertEqual(buildHTMLParagraphs(snippet), ['One &lt; Two'])
     snippet = '''<p>One &lt; <strong>Two</strong></p>'''
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['One &lt; <strong>Two</strong>'])
 def test_br(self):
     snippet = dedent('''
         <p>One paragraph<br/>Another line</p>''')
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['One paragraph',
                       'Another line'])
     snippet = '''<p>One paragraph<br>    <br></p>'''
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['One paragraph'])
 def test_entities(self):
     snippet = '''<p>One &amp; Two</p>'''
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['One &amp; Two'])
     snippet = '''<p>One&nbsp;&lt;&nbsp;Two</p>'''
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['One &lt; Two'])
     snippet = '''<p>One &lt; <strong>Two</strong></p>'''
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['One &lt; <strong>Two</strong>'])
Exemple #7
0
 def test_p(self):
     snippet = 'Text'
     self.assertEqual(buildHTMLParagraphs(snippet), ['Text'])
     snippet = '''<p>One paragraph</p>'''
     self.assertEqual(buildHTMLParagraphs(snippet), ['One paragraph'])
     snippet = '''<p>One paragraph</p><p> </p>'''
     self.assertEqual(buildHTMLParagraphs(snippet), ['One paragraph'])
     snippet = dedent('''
         <p>One paragraph</p>
         <p>Another paragraph</p>''')
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['One paragraph', 'Another paragraph'])
 def test_p(self):
     snippet = 'Text'
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['Text'])
     snippet = '''<p>One paragraph</p>'''
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['One paragraph'])
     snippet = '''<p>One paragraph</p><p> </p>'''
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['One paragraph'])
     snippet = dedent('''
         <p>One paragraph</p>
         <p>Another paragraph</p>''')
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['One paragraph',
                       'Another paragraph'])
 def test_other_tags(self):
     snippet = '''<ul><li>One</li><li>Two</li></ul>'''
     self.assertEqual(buildHTMLParagraphs(snippet),
                      ['&lt;ul&gt;&lt;li&gt;One&lt;/li&gt;&lt;li&gt;Two&lt;/li&gt;&lt;/ul&gt;'])
Exemple #10
0
 def test_other_tags(self):
     snippet = '''<ul><li>One</li><li>Two</li></ul>'''
     self.assertEqual(buildHTMLParagraphs(snippet), [
         '&lt;ul&gt;&lt;li&gt;One&lt;/li&gt;&lt;li&gt;Two&lt;/li&gt;&lt;/ul&gt;'
     ])