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