-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
56 lines (38 loc) · 945 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import nose
from nose.tools import *
import gifruw
def test_basic_html():
d = gifruw.Document()
d.doctype()
with d.html():
with d.body():
d.p('test')
assert_equal(d.render(),
'<!DOCTYPE html>'
'<html>'
'<body>'
'<p>test</p>'
'</body>'
'</html>'
)
def test_autoescape():
d = gifruw.Document()
d.p("&<>")
with d.autoescape_off():
d.p("&<>")
assert_equal(d.render(), '<p>&<></p><p>&<></p>')
def test_ic():
d = gifruw.Document()
d.div('#id.class1.class2')
assert_equal(d.render(), '<div id=\'id\' class=\'class1 class2\'></div>')
def test_attributes():
d = gifruw.Document()
d.h1('Header', style = 'bar')
d.div(data_attr = 'foo')
assert_equal(d.render(), '<h1 style=\'bar\'>Header</h1><div data-attr=\'foo\'></div>')
def test_void_element():
d = gifruw.Document()
d.img(src = 'image')
assert_equal(d.render(), '<img src=\'image\'/>')
if __name__ == '__main__':
nose.main()