Exemplo n.º 1
0
 def test_to_string(self):
     data = {
         'test': {
             'nodes': {
                 'node': ['Testing', 'Another node']
             },
         }
     }
     x = xml.from_dict(data)
     s = xml.to_string(x)
     expected_output = '<test><nodes><node>Testing</node><node>Another node</node></nodes></test>'
     declaration = '<?xml version="1.0" encoding="utf-8" ?>'
     assert s == expected_output
     assert xml.to_string(
         x, xml_declaration=True) == declaration + expected_output
Exemplo n.º 2
0
 def test_to_string(self):
     data = {
         'test': {
             'nodes': {
                 'node': [
                     'Testing',
                     'Another node'
                 ]
             },
         }
     }
     x = xml.from_dict(data)
     s = xml.to_string(x)
     expected_output = '<test><nodes><node>Testing</node><node>Another node</node></nodes></test>'
     declaration = '<?xml version="1.0" encoding="utf-8" ?>'
     assert s == expected_output
     assert xml.to_string(x, xml_declaration=True) == declaration + expected_output
Exemplo n.º 3
0
 def __call__(self, view_model, context=None):
     _xml = xml.from_dict(view_model.data)
     return xml.to_string(_xml, xml_declaration=True)
Exemplo n.º 4
0
 def __call__(self, view_model, context=None):
     _xml = xml.from_dict(view_model.data)
     return xml.to_string(_xml, xml_declaration=True)
Exemplo n.º 5
0
 def __call__(self, view_model, context=None):
     data = view_model.data
     if view_model.template in shared.TEMPLATES.keys():
         data = self._formatted_error(view_model, context)
     _xml = xml.from_dict(data)
     return xml.to_string(_xml, xml_declaration=True)