Remove print statements from Python tests

Use exceptions instead of printing to stdout.
Part of an effort to convert Python tests to python 3 syntax.
This commit is contained in:
William S Fulton 2020-08-13 21:22:47 +01:00
commit 365d4961d4
40 changed files with 123 additions and 254 deletions

View file

@ -3,7 +3,6 @@
# union embedded within a struct can be set and read correctly.
import unions
import sys
import string
# Create new instances of SmallStruct and BigStruct for later use
@ -23,28 +22,23 @@ eut.number = 1
eut.uni.small = small
Jill1 = eut.uni.small.jill
if (Jill1 != 200):
print "Runtime test1 failed. eut.uni.small.jill=", Jill1
sys.exit(1)
raise RuntimeError("Runtime test1 failed. eut.uni.small.jill={}".format(Jill1))
Num1 = eut.number
if (Num1 != 1):
print "Runtime test2 failed. eut.number=", Num1
sys.exit(1)
raise RuntimeError("Runtime test2 failed. eut.number=".format(Num1))
# Secondly check the BigStruct in EmbeddedUnionTest
eut.number = 2
eut.uni.big = big
Jack1 = eut.uni.big.jack
if (Jack1 != 300):
print "Runtime test3 failed. eut.uni.big.jack=", Jack1
sys.exit(1)
raise RuntimeError("Runtime test3 failed. eut.uni.big.jack={}".format(Jack1))
Jill2 = eut.uni.big.smallstruct.jill
if (Jill2 != 200):
print "Runtime test4 failed. eut.uni.big.smallstruct.jill=", Jill2
sys.exit(1)
raise RuntimeError("Runtime test4 failed. eut.uni.big.smallstruct.jill={}".format(Jill2))
Num2 = eut.number
if (Num2 != 2):
print "Runtime test5 failed. eut.number=", Num2
sys.exit(1)
raise RuntimeError("Runtime test5 failed. eut.number={}".format(Num2))