comparison emeraldtree/tests/test_ElementTree.py @ 10:fc4b72233da0

Add testcases. emeraldtree/tests/test_ElementTree.py: Add testcases for Comment and ProcessingInstruction.
author Bastian Blank <bblank@thinkmo.de>
date Sat, 31 May 2008 16:20:53 +0200
parents e1d0cd336bf3
children 60f59340b897
comparison
equal deleted inserted replaced
9:e0965f86912a 10:fc4b72233da0
47 47
48 elem.append('b') 48 elem.append('b')
49 l = list(elem.itertext()) 49 l = list(elem.itertext())
50 assert len(l) == 1 50 assert len(l) == 1
51 51
52 def test_Comment():
53 elem = Comment('a')
54 assert serialize(elem) == '<!--a-->'
55 assert isinstance(elem, Node)
56
57 def test_ProcessingInstruction():
58 elem = ProcessingInstruction('a')
59 assert serialize(elem) == '<?a?>'
60 assert isinstance(elem, ProcessingInstruction)
61
62 elem = ProcessingInstruction('a', 'b')
63 assert serialize(elem) == '<?a b?>'
64
52 def test_XMLParser_simple1(): 65 def test_XMLParser_simple1():
53 elem = XML('<a />') 66 elem = XML('<a />')
54 assert elem.tag == 'a' 67 assert elem.tag == 'a'
55 assert len(elem) == 0 68 assert len(elem) == 0
56 69