Beispiel #1
0
def test_append_child():
    n = Div()
    n.append('bar')
    assert n.children[0] == 'bar'
Beispiel #2
0
def test_setitem_exception():
    with pytest.raises(Exception):
        Div()[Div] = 'test'
Beispiel #3
0
def test_getitem_exception():
    with pytest.raises(Exception):
        Div()['data-lol']
Beispiel #4
0
def test_setitem_attr():
    n = Div()
    n['data-lol'] = 'a'
    assert n.attrs['data-lol'] == 'a'
Beispiel #5
0
def test_getitem_child():
    assert Div('a')[0] == 'a'
Beispiel #6
0
def test_init_div_tag():
    assert Div().tag == 'div'
Beispiel #7
0
def test_str_attr_child():
    assert str(Div({'class': 'a'}, 'b')) == '<div class="a">b</div>'
Beispiel #8
0
def test_init_attr():
    assert Div({'data-url': 'foo'}).attrs == {'data-url': 'foo'}
Beispiel #9
0
def test_str_children():
    assert str(Div('foo', Div())) == '<div>foo<div></div></div>'
Beispiel #10
0
def test_str_attr():
    assert str(Div({'class': 'a'})) == '<div class="a"></div>'
Beispiel #11
0
def test_str_child():
    assert str(Div('foo')) == '<div>foo</div>'
Beispiel #12
0
def test_str_default():
    assert str(Div()) == '<div></div>'
Beispiel #13
0
def test_init_children():
    assert Div('foo').children == ['foo']
Beispiel #14
0
def test_jinja():
    assert Div('{{ a }}').jinja(a=1) == '<div>1</div>'
Beispiel #15
0
def test_getitem_attr():
    assert Div({'class': 'a'})['class'] == 'a'
Beispiel #16
0
def test_init_div_attrs():
    assert Div().attrs == {}
Beispiel #17
0
def test_init_div_children():
    assert Div().children == []