I am running below code to parse xml file. The score is coming close to 21% only. Not able to understand why? Can you please suggest what needs to be done here to improve the score.
import os
import pandas as pd
from xml.dom import minidom
import coverage
def parseXml(DF, filePath):
xmldoc = minidom.parse(filePath)
PODs= xmldoc.getElementsByTagName("POD")
for pod in PODs:
if pod.hasAttribute("name") and pod.hasAttribute("DC") and pod.hasAttribute("deferLPUpgrade"):
DF = DF.append({'PODNAME': pod.getAttribute("name"), 'DC': pod.getAttribute("DC"), 'Upgrade': pod.getAttribute("deferLPUpgrade")}, ignore_index=True)
return(DF)
if __name__ == "__main__":
cov = coverage.Coverage()
cov.start()
FILENAME = "schedule.xml"
COL_NAMES = ['PODNAME', 'DC', 'Upgrade']
DF = pd.DataFrame(columns = COL_NAMES)
DF = parseXml(DF, FILENAME)
print DF
head, tail = os.path.splitext(FILENAME)
OUT_FILE = os.path.join(head + '.csv')
DF.to_csv(OUT_FILE, sep=',', index=False)
cov.stop()
cov.save()
cov.html_report(directory='covhtml')
Below is the temp_py.html
