Пример #1
0
def test_vselect_value_with_unicode_coertion():
    # FIXME: This test may fail in Python 3.4 because of HTML attribute
    # ordering.
    s = mod.vselect('foo', ((1, 'bar'), (2, 'baz')), {'foo': '1'})
    assert mod.tag('option', 'bar', value=1, selected=None) in s
    assert mod.tag('option', 'baz', value=2) in s
    s = mod.vselect('foo', ((1, 'bar'), (2, 'baz')), {'foo': 2})
    assert mod.tag('option', 'bar', value=1) in s
    assert mod.tag('option', 'baz', value=2, selected=None) in s
Пример #2
0
 def render(self):
     return html.tag('label',
                     html.html_escape(self.text),
                     _for=self.for_element)
Пример #3
0
def test_tag_content():
    assert mod.tag('foo', 'bar') == '<foo>bar</foo>'
Пример #4
0
def test_tag():
    assert mod.tag('foo') == '<foo></foo>'
Пример #5
0
def test_vselect_empty():
    s = mod.vselect('foo', ((1, 'bar'),), {}, empty='foo')
    assert mod.tag('option', 'foo', value=None) in s
    assert mod.tag('option', 'bar', value=1) in s
Пример #6
0
def test_vselect_choices():
    s = mod.vselect('foo', ((1, 'bar'), (2, 'baz')), {})
    assert mod.tag('option', 'bar', value=1) in s
    assert mod.tag('option', 'baz', value=2) in s
Пример #7
0
def test_tag_attribute_with_underscore():
    assert mod.tag('foo', _bar='fam') == '<foo bar="fam"></foo>'
Пример #8
0
def test_tag_attributes():
    assert mod.tag('foo', bar='fam') == '<foo bar="fam"></foo>'
Пример #9
0
def test_nonclosing_tag():
    assert mod.tag('foo', nonclosing=True) == '<foo>'
    assert mod.tag('foo', 'bar', nonclosing=True) == '<foo>'
Пример #10
0
def test_tag_content_html():
    assert mod.tag('foo', '<bar>') == '<foo><bar></foo>'
Пример #11
0
 def render(self):
     return html.tag('label',
                     self.text,
                     _for=self.for_element)