New test for NWStatus class

This commit is contained in:
Veronica K. B. Olsen
2020-12-03 20:22:22 +01:00
parent c7c70a35a0
commit 0cb36c02f3
5 changed files with 132 additions and 16 deletions
+4 -12
View File
@@ -79,6 +79,7 @@ class NWStatus():
theStatus = checkInt(theStatus, 0, False)
if theStatus >= 0 and theStatus < self._theLength:
return self._theLabels[theStatus]
return self._theLabels[0]
def setNewEntries(self, newList):
"""Update the list of entries after they have been modified by
@@ -136,18 +137,9 @@ class NWStatus():
for xChild in xParent:
theLabels.append(xChild.text)
if "red" in xChild.attrib:
cR = checkInt(xChild.attrib["red"], 0, False)
else:
cR = 0
if "green" in xChild.attrib:
cG = checkInt(xChild.attrib["green"], 0, False)
else:
cG = 0
if "blue" in xChild.attrib:
cB = checkInt(xChild.attrib["blue"], 0, False)
else:
cB = 0
cR = checkInt(xChild.attrib.get("red", 0), 0, False)
cG = checkInt(xChild.attrib.get("green", 0), 0, False)
cB = checkInt(xChild.attrib.get("blue", 0), 0, False)
theColours.append((cR, cG, cB))
if len(theLabels) > 0: