diff options
Diffstat (limited to 'Examples/test-suite/python/contract_runme.py')
-rw-r--r-- | Examples/test-suite/python/contract_runme.py | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/Examples/test-suite/python/contract_runme.py b/Examples/test-suite/python/contract_runme.py index cd75a51d2..b6bab3a09 100644 --- a/Examples/test-suite/python/contract_runme.py +++ b/Examples/test-suite/python/contract_runme.py @@ -2,141 +2,141 @@ import contract contract.test_preassert(1, 2) try: - contract.test_preassert(-1) - print "Failed! Preassertions are broken" -except: + contract.test_preassert(-1, 3) + raise Exception("Failed! Preassertions are broken") +except RuntimeError: pass contract.test_postassert(3) try: contract.test_postassert(-3) - print "Failed! Postassertions are broken" -except: + raise Exception("Failed! Postassertions are broken") +except RuntimeError: pass contract.test_prepost(2, 3) contract.test_prepost(5, -4) try: contract.test_prepost(-3, 4) - print "Failed! Preassertions are broken" -except: + raise Exception("Failed! Preassertions are broken") +except RuntimeError: pass try: contract.test_prepost(4, -10) - print "Failed! Postassertions are broken" + raise Exception("Failed! Postassertions are broken") -except: +except RuntimeError: pass f = contract.Foo() f.test_preassert(4, 5) try: f.test_preassert(-2, 3) - print "Failed! Method preassertion." -except: + raise Exception("Failed! Method preassertion.") +except RuntimeError: pass f.test_postassert(4) try: f.test_postassert(-4) - print "Failed! Method postassertion" -except: + raise Exception("Failed! Method postassertion") +except RuntimeError: pass f.test_prepost(3, 4) f.test_prepost(4, -3) try: f.test_prepost(-4, 2) - print "Failed! Method preassertion." -except: + raise Exception("Failed! Method preassertion.") +except RuntimeError: pass try: f.test_prepost(4, -10) - print "Failed! Method postassertion." -except: + raise Exception("Failed! Method postassertion.") +except RuntimeError: pass contract.Foo_stest_prepost(4, 0) try: contract.Foo_stest_prepost(-4, 2) - print "Failed! Static method preassertion" -except: + raise Exception("Failed! Static method preassertion") +except RuntimeError: pass try: contract.Foo_stest_prepost(4, -10) - print "Failed! Static method posteassertion" -except: + raise Exception("Failed! Static method posteassertion") +except RuntimeError: pass b = contract.Bar() try: b.test_prepost(2, -4) - print "Failed! Inherited preassertion." -except: + raise Exception("Failed! Inherited preassertion.") +except RuntimeError: pass d = contract.D() try: d.foo(-1, 1, 1, 1, 1) - print "Failed! Inherited preassertion (D)." -except: + raise Exception("Failed! Inherited preassertion (D).") +except RuntimeError: pass try: d.foo(1, -1, 1, 1, 1) - print "Failed! Inherited preassertion (D)." -except: + raise Exception("Failed! Inherited preassertion (D).") +except RuntimeError: pass try: d.foo(1, 1, -1, 1, 1) - print "Failed! Inherited preassertion (D)." -except: + raise Exception("Failed! Inherited preassertion (D).") +except RuntimeError: pass try: d.foo(1, 1, 1, -1, 1) - print "Failed! Inherited preassertion (D)." -except: + raise Exception("Failed! Inherited preassertion (D).") +except RuntimeError: pass try: d.foo(1, 1, 1, 1, -1) - print "Failed! Inherited preassertion (D)." -except: + raise Exception("Failed! Inherited preassertion (D).") +except RuntimeError: pass try: d.bar(-1, 1, 1, 1, 1) - print "Failed! Inherited preassertion (D)." -except: + raise Exception("Failed! Inherited preassertion (D).") +except RuntimeError: pass try: d.bar(1, -1, 1, 1, 1) - print "Failed! Inherited preassertion (D)." -except: + raise Exception("Failed! Inherited preassertion (D).") +except RuntimeError: pass try: d.bar(1, 1, -1, 1, 1) - print "Failed! Inherited preassertion (D)." -except: + raise Exception("Failed! Inherited preassertion (D).") +except RuntimeError: pass try: d.bar(1, 1, 1, -1, 1) - print "Failed! Inherited preassertion (D)." -except: + raise Exception("Failed! Inherited preassertion (D).") +except RuntimeError: pass try: d.bar(1, 1, 1, 1, -1) - print "Failed! Inherited preassertion (D)." -except: + raise Exception("Failed! Inherited preassertion (D).") +except RuntimeError: pass # Namespace my = contract.myClass(1) try: my = contract.myClass(0) - print "Failed! constructor preassertion" -except: + raise Exception("Failed! constructor preassertion") +except RuntimeError: pass |