Commit cd062558 by Ned Batchelder

Fix a test to allow for the exception to be repr'd.

parent 4e1d1922
...@@ -79,7 +79,12 @@ class SafeExecTests(unittest.TestCase): ...@@ -79,7 +79,12 @@ class SafeExecTests(unittest.TestCase):
raise ValueError("That's not how you pour soup!") raise ValueError("That's not how you pour soup!")
"""), globs) """), globs)
msg = str(what_happened.exception) msg = str(what_happened.exception)
self.assertIn("ValueError: That's not how you pour soup!", msg) # The result may be repr'd or not, so the backslash needs to be
# optional in this match.
self.assertRegexpMatches(
msg,
r"ValueError: That\\?'s not how you pour soup!"
)
def test_extra_files(self): def test_extra_files(self):
globs = {} globs = {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment