Debian Codegraph @

cpython27/Lib/test/test_eof.py

raw symbols SCIP
1 """test script for a few new invalid token catches"""
2
3 import unittest
4 from test import test_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, 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
27 def test_main():
28 test_support.run_unittest(EOFTestCase)
29
30 if __name__ == "__main__":
31 test_main()