Example #1
0
 def test_spanish_filter(self):
     """
     Test usage of the blacklist with spanish via the templatetag.
     """
     before = "<h1>Me encanta guiones</h1>"
     after = softhyphen(before, language='es-es')
     self.failUnlessEqual(after, "<h1>Me en&shy;can&shy;ta gu&shy;io&shy;nes</h1>")
Example #2
0
 def test_simple_filter(self):
     """
     Test simple usage of the hyphenation method via the templatetag.
     """
     before = "<h1>I love hyphenation</h1>"
     after = softhyphen(before)
     self.failUnlessEqual(after, "<h1>I love hy&shy;phen&shy;a&shy;tion</h1>")
Example #3
0
    def test_russian_filter(self):
        """
        Test usage of the templatetag with Russian.

        Also tests that the tag works properly with non-ascii characters.
        """
        before = u'<h1>\u043f\u0435\u0440\u0435.</h1>'
        after = softhyphen(before, language='ru-ru')
        self.failUnlessEqual(after, u'<h1>\u043f\u0435&shy;\u0440\u0435.</h1>')
Example #4
0
    def test_russian_filter(self):
        """
        Test usage of the templatetag with Russian.

        Also tests that the tag works properly with non-ascii characters.
        """
        before = u'<h1>\u042f \u043b\u044e\u0431\u043b\u044e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044b.</h1>'
        after = softhyphen(before, language='ru-ru')
        self.failUnlessEqual(after, u'<h1>\u042f \u043b\u044e&shy;\u0431\u043b\u044e \u043f\u0435&shy;\u0440\u0435&shy;\u043d\u043e&shy;\u0441\u044b.</h1>')