blob: aae35182bd1811a5fa24143bd8ee8e84bf6e776c [file] [log] [blame]
Skip Montanaro8c913372002-08-15 01:28:54 +00001#! /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):
Jeremy Hylton3e0055f2005-10-20 19:59:25 +000010 expect = "EOL while scanning single-quoted string (<string>, line 1)"
Skip Montanaro8c913372002-08-15 01:28:54 +000011 try:
12 eval("""'this is a test\
13 """)
14 except SyntaxError, msg:
Jeremy Hylton3e0055f2005-10-20 19:59:25 +000015 self.assertEqual(str(msg), expect)
Skip Montanaro8c913372002-08-15 01:28:54 +000016 else:
17 raise test_support.TestFailed
18
19 def test_EOFS(self):
Jeremy Hylton3e0055f2005-10-20 19:59:25 +000020 expect = "EOF while scanning triple-quoted string (<string>, line 1)"
Skip Montanaro8c913372002-08-15 01:28:54 +000021 try:
22 eval("""'''this is a test""")
23 except SyntaxError, msg:
Jeremy Hylton3e0055f2005-10-20 19:59:25 +000024 self.assertEqual(str(msg), expect)
Skip Montanaro8c913372002-08-15 01:28:54 +000025 else:
26 raise test_support.TestFailed
27
28def test_main():
29 test_support.run_unittest(EOFTestCase)
30
31if __name__ == "__main__":
32 test_main()