Data-Test-Executer Framework speziell zum Test von Datenverarbeitungen mit Datengenerierung, Systemvorbereitungen, Einspielungen, ganzheitlicher diversifizierender Vergleich
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
1.2 KiB

import os, sys, json
import xmltodict
import pprint
class fcts:
def dict2xml(tree):
out = xmltodict.unparse(tree, pretty=True)
return out
def xml2dict(xmlstring):
tree = {}
pp = pprint.PrettyPrinter(indent=4)
tree = xmlstring.parse(xmlstring)
return tree
def readXml(filename):
pass
def addNode(xpath, value):
pass
def writeDataTable(teststatus, tdata, comp):
"""
writes the testdata into a csv-file for documentation of the test-run
:param teststatus:
:param tdata:
:param comp: if specific else None
:return:
"""
#output = xmljson.badgerfish.etree(tdata, root=xmljson.badgerfish.Element('root'))
result = bf.etree(tdata, root=Element('xml'))
# xmljson.badgerfish.tostring(output)
txt = tostring(result, pretty_print=True)
print (txt.decode('utf-8'))
# out = tostring(result, pretty_print=True)
#print (prettify(result))
pass
def prettify(elem):
"""Return a pretty-printed XML string for the Element.
"""
rough_string = tostring(elem, 'utf-8')
reparsed = xml.dom.minidom.parseString(rough_string )
return reparsed.toprettyxml(indent=" ")