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