Use exceptions instead of printing to stdout. Part of an effort to convert Python tests to python 3 syntax.
19 lines
253 B
Python
19 lines
253 B
Python
import inplaceadd
|
|
a = inplaceadd.A(7)
|
|
|
|
a += 5
|
|
if a.val != 12:
|
|
raise RuntimeError("a.val: {}".format(a.val))
|
|
|
|
a -= 5
|
|
if a.val != 7:
|
|
raise RuntimeError
|
|
|
|
a *= 2
|
|
|
|
if a.val != 14:
|
|
raise RuntimeError
|
|
|
|
a += a
|
|
if a.val != 28:
|
|
raise RuntimeError
|