From 353bdd8cadfa1649d35ae6c87b6803c0b5ac134b Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sat, 6 Jun 2015 04:30:19 +0200 Subject: Test for exceptions in a cleaner way. --- testsuite.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'testsuite.py') 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""" ' """) -- cgit v1.2.3