Make the exception message check for malformed UTF-8 source looser so that SyntaxError triggered from UnicodeDecodeError is also acceptable.

This commit is contained in:
Brett Cannon 2009-08-30 20:07:38 +00:00
parent de4ebfe559
commit 2dd66ce828
1 changed files with 2 additions and 1 deletions

View File

@ -19,7 +19,8 @@ class PEP3120Test(unittest.TestCase):
try:
import test.badsyntax_pep3120
except SyntaxError as msg:
self.assertTrue(str(msg).find("Non-UTF-8 code starting with") >= 0)
msg = str(msg)
self.assertTrue('UTF-8' in msg or 'utf8' in msg)
else:
self.fail("expected exception didn't occur")