"""
$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/qp/fill/test/utest_html.py $
$Id: utest_html.py 28351 2006-05-10 17:27:02Z dbinger $
"""
from sancho.utest import UTest
from qp.fill.html import href, div, ol, ul, dl, nl2br, url_with_query
from qpy import h8
class HTMLTest(UTest):
def a(self):
result = href('a', 'b', name="c")
assert isinstance(result, h8)
assert result == 'b'
def b(self):
result = div('a', 'b', c="d")
assert isinstance(result, h8)
assert result == '
ab
'
def c(self):
result = ol(['a', 'b'], c="d")
assert isinstance(result, h8)
assert result == '- a
- b
'
def d(self):
result = ul(['a', 'b'], c="d")
assert isinstance(result, h8)
assert result == ''
def e(self):
result = dl([('a', 'b'), ('e', None)], c="d")
assert isinstance(result, h8)
assert result == '- a
- b
- e
'
def f(self):
result = nl2br('')
assert isinstance(result, h8)
result = nl2br('a\nb\n')
assert isinstance(result, h8)
assert result == 'a
b
', result
def test_url_with_query(self):
result = url_with_query('/foo', x=1, y='A<')
assert isinstance(result, h8)
assert result == '/foo?y=A%3C&x=1', result
if __name__ == '__main__':
HTMLTest()