summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2015-06-06 04:30:19 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2015-06-06 04:30:19 +0200
commit353bdd8cadfa1649d35ae6c87b6803c0b5ac134b (patch)
tree03b055e86b444b14cd263830e586f5e196425967
parent71d9bb31f91fbd8f4e38e47fce54fd3221b3f8f5 (diff)
Test for exceptions in a cleaner way.
-rw-r--r--testsuite.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/testsuite.py b/testsuite.py
index 5ccff6d..820382c 100644
--- a/testsuite.py
+++ b/testsuite.py
@@ -208,13 +208,12 @@ def run_selftests():
the first and last characters from 's' so we can use readable raw
strings as input."""
s = s[1:-1]
- caught_exception = False
try:
c._tokenize(s, for_eval = True)
except kconfiglib.Kconfig_Syntax_Error:
- caught_exception = True
- verify(caught_exception, "Tokenization of '{0}' should have failed."
- .format(s))
+ pass
+ else:
+ fail("Tokenization of '{0}' should have failed.".format(s))
verify_string_bad(r""" " """)
verify_string_bad(r""" ' """)