def _get_complex_structure(self): tree = Tree() tree.instruct('xml') #tree.cdata(r"<b>I am some text.</b>") tree.declare('DOCTYPE', __.author, __.SYSTEM, 'SomeDTD.dtd') with tree.node('author') as author: author.node('name', 'Terry Pratchett') author.node('genre', 'Fantasy/Comedy') author.comment("Only 2 books listed") with author.node('novels', count=2) as novels: novels.node('novel', 'Small Gods', year=1992) novels.node('novel', 'The Fifth Elephant', year=1999) return tree
def test_render_declaration_no_values(self): tree = Tree() tree.declare('ELEMENT') self.assertIn(tree(), r'<!ELEMENT>')
def test_render_declaration(self): tree = Tree() tree.declare('ELEMENT', __.Value, 'A value here.') self.assertIn(tree(), r'<!ELEMENT Value "A value here.">')