annotate Lib/test/test_eof.py @ 54294:dba767bc3155 legacy-trunk

remove mention of old ctypes version
author Benjamin Peterson <benjamin@python.org>
date Sat, 23 May 2009 20:59:09 +0000
parents 1fdfb29f4fb8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24840
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
1 #! /usr/bin/env python
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
2 """test script for a few new invalid token catches"""
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
3
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
4 import unittest
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
5 from test import test_support
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
6
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
7 class EOFTestCase(unittest.TestCase):
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
8 def test_EOFC(self):
46889
1fdfb29f4fb8 #2816: clarify error messages for EOF while scanning strings.
Georg Brandl <georg@python.org>
parents: 45468
diff changeset
9 expect = "EOL while scanning string literal (<string>, line 1)"
24840
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
10 try:
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
11 eval("""'this is a test\
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
12 """)
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
13 except SyntaxError, msg:
35742
1c4d192f1568 Merge ast-branch to head
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 24840
diff changeset
14 self.assertEqual(str(msg), expect)
24840
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
15 else:
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
16 raise test_support.TestFailed
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
17
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
18 def test_EOFS(self):
46889
1fdfb29f4fb8 #2816: clarify error messages for EOF while scanning strings.
Georg Brandl <georg@python.org>
parents: 45468
diff changeset
19 expect = ("EOF while scanning triple-quoted string literal "
1fdfb29f4fb8 #2816: clarify error messages for EOF while scanning strings.
Georg Brandl <georg@python.org>
parents: 45468
diff changeset
20 "(<string>, line 1)")
24840
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
21 try:
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
22 eval("""'''this is a test""")
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
23 except SyntaxError, msg:
35742
1c4d192f1568 Merge ast-branch to head
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 24840
diff changeset
24 self.assertEqual(str(msg), expect)
24840
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
25 else:
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
26 raise test_support.TestFailed
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
27
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
28 def test_main():
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
29 test_support.run_unittest(EOFTestCase)
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
30
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
31 if __name__ == "__main__":
2ff4268f25dc forgot the best part - the new tests...
Skip Montanaro <skip@pobox.com>
parents:
diff changeset
32 test_main()