J
J. Cliff Dyer
This code cannot output "Unknown," because you use an else: at the endZara said:You should implement __str__ (or __repr__) method in your class,
class TestOutcomes:
PASSED = 0
FAILED = 1
ABORTED = 2
def __str__(self):
textResultAsString="Unknown"
if testResult == TestOutcomes.PASSED:
testResultAsString = "Passed"
elif testResult == TestOutcomes.FAILED :
testResultAsString = "Failed"
else:
testResultAsString = "Aborted"
return testResultAsString
Regards,
Zara
of your if-chain to represent a specific (non-catch-all) case.
s/else:/elif testResult == TestOutcomes.ABORTED:/
Cheers,
Cliff