ยปCore Development>Code coverage>Lib/test/test_eof.py

Python code coverage for Lib/test/test_eof.py

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