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