Home | History | Annotate | Download | only in test
      1 """test script for a few new invalid token catches"""
      2 
      3 import unittest
      4 from test import support
      5 
      6 class 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 as msg:
     13             self.assertEqual(str(msg), expect)
     14         else:
     15             raise 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 as msg:
     23             self.assertEqual(str(msg), expect)
     24         else:
     25             raise support.TestFailed
     26 
     27 if __name__ == "__main__":
     28     unittest.main()
     29