source: trunk/essentials/dev-lang/python/Lib/test/test_eof.py@ 3951

Last change on this file since 3951 was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 879 bytes
Line 
1#! /usr/bin/env python
2"""test script for a few new invalid token catches"""
3
4import os
5import unittest
6from test import test_support
7
8class EOFTestCase(unittest.TestCase):
9 def test_EOFC(self):
10 expect = "EOL while scanning single-quoted string (<string>, line 1)"
11 try:
12 eval("""'this is a test\
13 """)
14 except SyntaxError, msg:
15 self.assertEqual(str(msg), expect)
16 else:
17 raise test_support.TestFailed
18
19 def test_EOFS(self):
20 expect = "EOF while scanning triple-quoted string (<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
28def test_main():
29 test_support.run_unittest(EOFTestCase)
30
31if __name__ == "__main__":
32 test_main()
Note: See TracBrowser for help on using the repository browser.