Hi,
I have the following class -
class TestOutcomes:
PASSED = 0
FAILED = 1
ABORTED = 2
plus the following code -
testResult = TestOutcomes.PA SSED
testResultAsStr ing
if testResult == TestOutcomes.PA SSED:
testResultAsStr ing = "Passed"
elif testResult == TestOutcomes.FA ILED :
testResultAsStr ing = "Failed"
else:
testResultAsStr ing = "Aborted"
But it would be much nicer if I had a function to covert to string as
part of the TestOutcomes class. How would I implement this?
Thanks,
Barry
I have the following class -
class TestOutcomes:
PASSED = 0
FAILED = 1
ABORTED = 2
plus the following code -
testResult = TestOutcomes.PA SSED
testResultAsStr ing
if testResult == TestOutcomes.PA SSED:
testResultAsStr ing = "Passed"
elif testResult == TestOutcomes.FA ILED :
testResultAsStr ing = "Failed"
else:
testResultAsStr ing = "Aborted"
But it would be much nicer if I had a function to covert to string as
part of the TestOutcomes class. How would I implement this?
Thanks,
Barry
Comment