Exemplo n.º 1
0
 def test_htmlize(self):
     for decr in [d1, d2, d3]:
         html_descr = htmlize_package_description(decr)
         #print html_descr
         #element = lxml.html.document_fromstring(html_descr)
         star_count = decr.count("*")
         root = lxml.etree.XML("<html>%s</html>" % html_descr)
         li_count = len(root.findall(".//li"))
         self.assertEqual(star_count, li_count)
    def test_htmlize(self):
        from softwarecenter.utils import htmlize_package_description
        s = """A challenging 3D block puzzle game.

Puzzle Moppet is a challenging 3D puzzle game featuring a diminutive and apparently mute creature who is lost in a mysterious floating landscape.

GAME FEATURES
* Save the Moppet from itself
"""
        description_text = htmlize_package_description(s)
        self.assertEqual(
            description_text,
            """<p tabindex="0">A challenging 3D block puzzle game.</p><p tabindex="0">Puzzle Moppet is a challenging 3D puzzle game featuring a diminutive and apparently mute creature who is lost in a mysterious floating landscape.</p><p tabindex="0">GAME FEATURES</p><ul><li>Save the Moppet from itself</li></ul>""")
    def test_htmlize(self):
        from softwarecenter.utils import htmlize_package_description
        s = """A challenging 3D block puzzle game.

Puzzle Moppet is a challenging 3D puzzle game featuring a diminutive and apparently mute creature who is lost in a mysterious floating landscape.

GAME FEATURES
* Save the Moppet from itself
"""
        description_text = htmlize_package_description(s)
        self.assertEqual(
            description_text,
            """<p tabindex="0">A challenging 3D block puzzle game.</p><p tabindex="0">Puzzle Moppet is a challenging 3D puzzle game featuring a diminutive and apparently mute creature who is lost in a mysterious floating landscape.</p><p tabindex="0">GAME FEATURES</p><ul><li>Save the Moppet from itself</li></ul>"""
        )