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