1"""test script for a few new invalid token catches""" 2 3import unittest 4from test import test_support 5 6class EOFTestCase(unittest.TestCase): 7 def test_EOFC(self): 8 expect = "EOL while scanning string literal (<string>, line 1)" 9 try: 10 eval("""'this is a test\ 11 """) 12 except SyntaxError, msg: 13 self.assertEqual(str(msg), expect) 14 else: 15 raise test_support.TestFailed 16 17 def test_EOFS(self): 18 expect = ("EOF while scanning triple-quoted string literal " 19 "(<string>, line 1)") 20 try: 21 eval("""'''this is a test""") 22 except SyntaxError, msg: 23 self.assertEqual(str(msg), expect) 24 else: 25 raise test_support.TestFailed 26 27def test_main(): 28 test_support.run_unittest(EOFTestCase) 29 30if __name__ == "__main__": 31 test_main() 32