Mercurial > genshi > mirror
diff genshi/filters/tests/i18n.py @ 667:c9a084ffaee6 trunk
Fix case where attributes weren't properly wrapped in an `Attrs` instance if one or more of them were translated by the I18n filter, potentially breaking things further down the chain. Closes #162.
author | cmlenz |
---|---|
date | Tue, 11 Dec 2007 21:17:18 +0000 |
parents | 23a4784203ae |
children | 9dd5f370a70e |
line wrap: on
line diff
--- a/genshi/filters/tests/i18n.py +++ b/genshi/filters/tests/i18n.py @@ -15,12 +15,26 @@ from StringIO import StringIO import unittest +from genshi.core import Attrs from genshi.template import MarkupTemplate from genshi.filters.i18n import Translator, extract +from genshi.input import HTML class TranslatorTestCase(unittest.TestCase): + def test_translate_included_attribute_text(self): + """ + Verify that translated attributes end up in a proper `Attrs` instance. + """ + html = HTML("""<html> + <span title="Foo"></span> + </html>""") + translator = Translator(lambda s: u"Voh") + stream = list(html.filter(translator)) + kind, data, pos = stream[2] + assert isinstance(data[1], Attrs) + def test_extract_without_text(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> <p title="Bar">Foo</p>