blob: 03803d9aaf37b336fba1982d2c8123b69acb5702 [file] [log] [blame]
Fred Drake79ca79d2000-08-21 22:30:53 +00001import parser
Benjamin Peterson6624a9f2008-11-03 15:14:51 +00002import os
Fred Drake58422e52001-06-04 03:56:24 +00003import unittest
Martin v. Löwis66e26632008-03-18 13:16:05 +00004import sys
Barry Warsaw04f357c2002-07-23 19:04:11 +00005from test import test_support
Fred Drake79ca79d2000-08-21 22:30:53 +00006
7#
8# First, we test that we can generate trees from valid source fragments,
9# and that these valid trees are indeed allowed by the tree-loading side
10# of the parser module.
11#
12
Fred Drake58422e52001-06-04 03:56:24 +000013class RoundtripLegalSyntaxTestCase(unittest.TestCase):
Guido van Rossum32c2ae72002-08-22 19:45:32 +000014
Fred Drake58422e52001-06-04 03:56:24 +000015 def roundtrip(self, f, s):
16 st1 = f(s)
17 t = st1.totuple()
18 try:
Fred Drake6e4f2c02001-07-17 19:33:25 +000019 st2 = parser.sequence2st(t)
Anthony Baxterc2a5a632004-08-02 06:10:11 +000020 except parser.ParserError, why:
21 self.fail("could not roundtrip %r: %s" % (s, why))
Fred Drake79ca79d2000-08-21 22:30:53 +000022
Fred Drake58422e52001-06-04 03:56:24 +000023 self.assertEquals(t, st2.totuple(),
24 "could not re-generate syntax tree")
Fred Drake28f739a2000-08-25 22:42:40 +000025
Fred Drake58422e52001-06-04 03:56:24 +000026 def check_expr(self, s):
27 self.roundtrip(parser.expr, s)
Fred Drake28f739a2000-08-25 22:42:40 +000028
Benjamin Petersondcee09d2008-10-31 02:16:05 +000029 def test_flags_passed(self):
30 # The unicode literals flags has to be passed from the paser to AST
31 # generation.
32 suite = parser.suite("from __future__ import unicode_literals; x = ''")
33 code = suite.compile()
34 scope = {}
35 exec code in scope
36 self.assertTrue(isinstance(scope["x"], unicode))
37
Fred Drake58422e52001-06-04 03:56:24 +000038 def check_suite(self, s):
39 self.roundtrip(parser.suite, s)
Fred Drake28f739a2000-08-25 22:42:40 +000040
Fred Drakecf580c72001-07-17 03:01:29 +000041 def test_yield_statement(self):
Tim Peters496563a2002-04-01 00:28:59 +000042 self.check_suite("def f(): yield 1")
Phillip J. Eby0d6615f2005-08-02 00:46:46 +000043 self.check_suite("def f(): yield")
44 self.check_suite("def f(): x += yield")
45 self.check_suite("def f(): x = yield 1")
46 self.check_suite("def f(): x = y = yield 1")
47 self.check_suite("def f(): x = yield")
48 self.check_suite("def f(): x = y = yield")
49 self.check_suite("def f(): 1 + (yield)*2")
50 self.check_suite("def f(): (yield 1)*2")
Tim Peters496563a2002-04-01 00:28:59 +000051 self.check_suite("def f(): return; yield 1")
52 self.check_suite("def f(): yield 1; return")
53 self.check_suite("def f():\n"
Fred Drakecf580c72001-07-17 03:01:29 +000054 " for x in range(30):\n"
55 " yield x\n")
Phillip J. Eby0d6615f2005-08-02 00:46:46 +000056 self.check_suite("def f():\n"
57 " if (yield):\n"
58 " yield x\n")
Fred Drakecf580c72001-07-17 03:01:29 +000059
Fred Drake58422e52001-06-04 03:56:24 +000060 def test_expressions(self):
61 self.check_expr("foo(1)")
Alexandre Vassalottiee936a22010-01-09 23:35:54 +000062 self.check_expr("{1:1}")
63 self.check_expr("{1:1, 2:2, 3:3}")
64 self.check_expr("{1:1, 2:2, 3:3,}")
65 self.check_expr("{1}")
66 self.check_expr("{1, 2, 3}")
67 self.check_expr("{1, 2, 3,}")
68 self.check_expr("[]")
69 self.check_expr("[1]")
Fred Drake58422e52001-06-04 03:56:24 +000070 self.check_expr("[1, 2, 3]")
Alexandre Vassalottiee936a22010-01-09 23:35:54 +000071 self.check_expr("[1, 2, 3,]")
72 self.check_expr("()")
73 self.check_expr("(1,)")
74 self.check_expr("(1, 2, 3)")
75 self.check_expr("(1, 2, 3,)")
Fred Drake58422e52001-06-04 03:56:24 +000076 self.check_expr("[x**3 for x in range(20)]")
77 self.check_expr("[x**3 for x in range(20) if x % 3]")
Neal Norwitzd3a91622006-04-12 05:27:46 +000078 self.check_expr("[x**3 for x in range(20) if x % 2 if x % 3]")
79 self.check_expr("list(x**3 for x in range(20))")
80 self.check_expr("list(x**3 for x in range(20) if x % 3)")
81 self.check_expr("list(x**3 for x in range(20) if x % 2 if x % 3)")
Fred Drake58422e52001-06-04 03:56:24 +000082 self.check_expr("foo(*args)")
83 self.check_expr("foo(*args, **kw)")
84 self.check_expr("foo(**kw)")
85 self.check_expr("foo(key=value)")
86 self.check_expr("foo(key=value, *args)")
87 self.check_expr("foo(key=value, *args, **kw)")
88 self.check_expr("foo(key=value, **kw)")
89 self.check_expr("foo(a, b, c, *args)")
90 self.check_expr("foo(a, b, c, *args, **kw)")
91 self.check_expr("foo(a, b, c, **kw)")
Benjamin Petersonbd6a05f2008-08-19 22:06:11 +000092 self.check_expr("foo(a, *args, keyword=23)")
Fred Drake58422e52001-06-04 03:56:24 +000093 self.check_expr("foo + bar")
Michael W. Hudson5e83b7a2003-01-29 14:20:23 +000094 self.check_expr("foo - bar")
95 self.check_expr("foo * bar")
96 self.check_expr("foo / bar")
97 self.check_expr("foo // bar")
Fred Drake58422e52001-06-04 03:56:24 +000098 self.check_expr("lambda: 0")
99 self.check_expr("lambda x: 0")
100 self.check_expr("lambda *y: 0")
101 self.check_expr("lambda *y, **z: 0")
102 self.check_expr("lambda **z: 0")
103 self.check_expr("lambda x, y: 0")
104 self.check_expr("lambda foo=bar: 0")
105 self.check_expr("lambda foo=bar, spaz=nifty+spit: 0")
106 self.check_expr("lambda foo=bar, **z: 0")
107 self.check_expr("lambda foo=bar, blaz=blat+2, **z: 0")
108 self.check_expr("lambda foo=bar, blaz=blat+2, *y, **z: 0")
109 self.check_expr("lambda x, *y, **z: 0")
Raymond Hettinger354433a2004-05-19 08:20:33 +0000110 self.check_expr("(x for x in range(10))")
111 self.check_expr("foo(x for x in range(10))")
Fred Drake79ca79d2000-08-21 22:30:53 +0000112
Fred Drake58422e52001-06-04 03:56:24 +0000113 def test_print(self):
114 self.check_suite("print")
115 self.check_suite("print 1")
116 self.check_suite("print 1,")
117 self.check_suite("print >>fp")
118 self.check_suite("print >>fp, 1")
119 self.check_suite("print >>fp, 1,")
Fred Drake79ca79d2000-08-21 22:30:53 +0000120
Fred Drake58422e52001-06-04 03:56:24 +0000121 def test_simple_expression(self):
122 # expr_stmt
123 self.check_suite("a")
Fred Drake79ca79d2000-08-21 22:30:53 +0000124
Fred Drake58422e52001-06-04 03:56:24 +0000125 def test_simple_assignments(self):
126 self.check_suite("a = b")
127 self.check_suite("a = b = c = d = e")
Fred Drake28f739a2000-08-25 22:42:40 +0000128
Fred Drake58422e52001-06-04 03:56:24 +0000129 def test_simple_augmented_assignments(self):
130 self.check_suite("a += b")
131 self.check_suite("a -= b")
132 self.check_suite("a *= b")
133 self.check_suite("a /= b")
Michael W. Hudson5e83b7a2003-01-29 14:20:23 +0000134 self.check_suite("a //= b")
Fred Drake58422e52001-06-04 03:56:24 +0000135 self.check_suite("a %= b")
136 self.check_suite("a &= b")
137 self.check_suite("a |= b")
138 self.check_suite("a ^= b")
139 self.check_suite("a <<= b")
140 self.check_suite("a >>= b")
141 self.check_suite("a **= b")
Fred Drakee3fb18c2001-01-07 06:02:19 +0000142
Fred Drake58422e52001-06-04 03:56:24 +0000143 def test_function_defs(self):
144 self.check_suite("def f(): pass")
145 self.check_suite("def f(*args): pass")
146 self.check_suite("def f(*args, **kw): pass")
147 self.check_suite("def f(**kw): pass")
148 self.check_suite("def f(foo=bar): pass")
149 self.check_suite("def f(foo=bar, *args): pass")
150 self.check_suite("def f(foo=bar, *args, **kw): pass")
151 self.check_suite("def f(foo=bar, **kw): pass")
Fred Drakee3fb18c2001-01-07 06:02:19 +0000152
Fred Drake58422e52001-06-04 03:56:24 +0000153 self.check_suite("def f(a, b): pass")
154 self.check_suite("def f(a, b, *args): pass")
155 self.check_suite("def f(a, b, *args, **kw): pass")
156 self.check_suite("def f(a, b, **kw): pass")
157 self.check_suite("def f(a, b, foo=bar): pass")
158 self.check_suite("def f(a, b, foo=bar, *args): pass")
159 self.check_suite("def f(a, b, foo=bar, *args, **kw): pass")
160 self.check_suite("def f(a, b, foo=bar, **kw): pass")
Fred Drakee3fb18c2001-01-07 06:02:19 +0000161
Anthony Baxterc2a5a632004-08-02 06:10:11 +0000162 self.check_suite("@staticmethod\n"
163 "def f(): pass")
164 self.check_suite("@staticmethod\n"
165 "@funcattrs(x, y)\n"
166 "def f(): pass")
167 self.check_suite("@funcattrs()\n"
168 "def f(): pass")
169
Brett Cannonf4189912005-04-09 02:30:16 +0000170 def test_class_defs(self):
171 self.check_suite("class foo():pass")
Tim Peterse8906822005-04-20 17:45:13 +0000172
Fred Drake58422e52001-06-04 03:56:24 +0000173 def test_import_from_statement(self):
174 self.check_suite("from sys.path import *")
175 self.check_suite("from sys.path import dirname")
Anthony Baxter1a4ddae2004-08-31 10:07:13 +0000176 self.check_suite("from sys.path import (dirname)")
177 self.check_suite("from sys.path import (dirname,)")
Fred Drake58422e52001-06-04 03:56:24 +0000178 self.check_suite("from sys.path import dirname as my_dirname")
Anthony Baxter1a4ddae2004-08-31 10:07:13 +0000179 self.check_suite("from sys.path import (dirname as my_dirname)")
180 self.check_suite("from sys.path import (dirname as my_dirname,)")
Fred Drake58422e52001-06-04 03:56:24 +0000181 self.check_suite("from sys.path import dirname, basename")
Anthony Baxter1a4ddae2004-08-31 10:07:13 +0000182 self.check_suite("from sys.path import (dirname, basename)")
183 self.check_suite("from sys.path import (dirname, basename,)")
Fred Drake58422e52001-06-04 03:56:24 +0000184 self.check_suite(
185 "from sys.path import dirname as my_dirname, basename")
186 self.check_suite(
Anthony Baxter1a4ddae2004-08-31 10:07:13 +0000187 "from sys.path import (dirname as my_dirname, basename)")
188 self.check_suite(
189 "from sys.path import (dirname as my_dirname, basename,)")
190 self.check_suite(
Fred Drake58422e52001-06-04 03:56:24 +0000191 "from sys.path import dirname, basename as my_basename")
Anthony Baxter1a4ddae2004-08-31 10:07:13 +0000192 self.check_suite(
193 "from sys.path import (dirname, basename as my_basename)")
194 self.check_suite(
195 "from sys.path import (dirname, basename as my_basename,)")
Benjamin Peterson6624a9f2008-11-03 15:14:51 +0000196 self.check_suite("from .bogus import x")
Fred Drakee3fb18c2001-01-07 06:02:19 +0000197
Fred Drake58422e52001-06-04 03:56:24 +0000198 def test_basic_import_statement(self):
199 self.check_suite("import sys")
200 self.check_suite("import sys as system")
201 self.check_suite("import sys, math")
202 self.check_suite("import sys as system, math")
203 self.check_suite("import sys, math as my_math")
Fred Drake79ca79d2000-08-21 22:30:53 +0000204
Neal Norwitz9caf9c02003-02-10 01:54:06 +0000205 def test_pep263(self):
206 self.check_suite("# -*- coding: iso-8859-1 -*-\n"
207 "pass\n")
208
209 def test_assert(self):
210 self.check_suite("assert alo < ahi and blo < bhi\n")
211
Benjamin Peterson9dfe6a82008-11-24 04:09:03 +0000212 def test_with(self):
213 self.check_suite("with open('x'): pass\n")
214 self.check_suite("with open('x') as f: pass\n")
Georg Brandl944f6842009-05-25 21:02:56 +0000215 self.check_suite("with open('x') as f, open('y') as g: pass\n")
Benjamin Peterson9dfe6a82008-11-24 04:09:03 +0000216
Georg Brandlfe879e82008-12-05 12:09:41 +0000217 def test_try_stmt(self):
218 self.check_suite("try: pass\nexcept: pass\n")
219 self.check_suite("try: pass\nfinally: pass\n")
220 self.check_suite("try: pass\nexcept A: pass\nfinally: pass\n")
221 self.check_suite("try: pass\nexcept A: pass\nexcept: pass\n"
222 "finally: pass\n")
223 self.check_suite("try: pass\nexcept: pass\nelse: pass\n")
224 self.check_suite("try: pass\nexcept: pass\nelse: pass\n"
225 "finally: pass\n")
226
Jeremy Hylton60e96f62006-08-22 20:46:00 +0000227 def test_position(self):
228 # An absolutely minimal test of position information. Better
229 # tests would be a big project.
Benjamin Petersona4a04d12009-12-06 21:24:30 +0000230 code = "def f(x):\n return x + 1"
Jeremy Hylton60e96f62006-08-22 20:46:00 +0000231 st1 = parser.suite(code)
232 st2 = st1.totuple(line_info=1, col_info=1)
233
234 def walk(tree):
235 node_type = tree[0]
236 next = tree[1]
237 if isinstance(next, tuple):
238 for elt in tree[1:]:
239 for x in walk(elt):
240 yield x
241 else:
242 yield tree
Tim Peters147f9ae2006-08-25 22:05:39 +0000243
Jeremy Hylton60e96f62006-08-22 20:46:00 +0000244 terminals = list(walk(st2))
245 self.assertEqual([
246 (1, 'def', 1, 0),
247 (1, 'f', 1, 4),
248 (7, '(', 1, 5),
249 (1, 'x', 1, 6),
250 (8, ')', 1, 7),
251 (11, ':', 1, 8),
252 (4, '', 1, 9),
253 (5, '', 2, -1),
254 (1, 'return', 2, 4),
255 (1, 'x', 2, 11),
256 (14, '+', 2, 13),
257 (2, '1', 2, 15),
258 (4, '', 2, 16),
Benjamin Petersona4a04d12009-12-06 21:24:30 +0000259 (6, '', 2, -1),
260 (4, '', 2, -1),
261 (0, '', 2, -1)],
Jeremy Hylton60e96f62006-08-22 20:46:00 +0000262 terminals)
263
264
Fred Drake79ca79d2000-08-21 22:30:53 +0000265#
266# Second, we take *invalid* trees and make sure we get ParserError
267# rejections for them.
268#
269
Fred Drake58422e52001-06-04 03:56:24 +0000270class IllegalSyntaxTestCase(unittest.TestCase):
Guido van Rossum32c2ae72002-08-22 19:45:32 +0000271
Fred Drake58422e52001-06-04 03:56:24 +0000272 def check_bad_tree(self, tree, label):
273 try:
Fred Drake6e4f2c02001-07-17 19:33:25 +0000274 parser.sequence2st(tree)
Fred Drake58422e52001-06-04 03:56:24 +0000275 except parser.ParserError:
276 pass
277 else:
278 self.fail("did not detect invalid tree for %r" % label)
Fred Drake79ca79d2000-08-21 22:30:53 +0000279
Fred Drake58422e52001-06-04 03:56:24 +0000280 def test_junk(self):
281 # not even remotely valid:
282 self.check_bad_tree((1, 2, 3), "<junk>")
283
Fred Drakecf580c72001-07-17 03:01:29 +0000284 def test_illegal_yield_1(self):
Guido van Rossum32c2ae72002-08-22 19:45:32 +0000285 # Illegal yield statement: def f(): return 1; yield 1
Fred Drakecf580c72001-07-17 03:01:29 +0000286 tree = \
287 (257,
288 (264,
289 (285,
290 (259,
291 (1, 'def'),
292 (1, 'f'),
293 (260, (7, '('), (8, ')')),
294 (11, ':'),
295 (291,
296 (4, ''),
297 (5, ''),
298 (264,
299 (265,
300 (266,
301 (272,
302 (275,
303 (1, 'return'),
304 (313,
305 (292,
306 (293,
307 (294,
308 (295,
309 (297,
310 (298,
311 (299,
312 (300,
313 (301,
314 (302, (303, (304, (305, (2, '1')))))))))))))))))),
315 (264,
316 (265,
317 (266,
318 (272,
319 (276,
320 (1, 'yield'),
321 (313,
322 (292,
323 (293,
324 (294,
325 (295,
326 (297,
327 (298,
328 (299,
329 (300,
330 (301,
331 (302,
332 (303, (304, (305, (2, '1')))))))))))))))))),
333 (4, ''))),
334 (6, ''))))),
335 (4, ''),
336 (0, ''))))
337 self.check_bad_tree(tree, "def f():\n return 1\n yield 1")
338
339 def test_illegal_yield_2(self):
Guido van Rossum32c2ae72002-08-22 19:45:32 +0000340 # Illegal return in generator: def f(): return 1; yield 1
Fred Drakecf580c72001-07-17 03:01:29 +0000341 tree = \
342 (257,
343 (264,
344 (265,
345 (266,
346 (278,
347 (1, 'from'),
348 (281, (1, '__future__')),
349 (1, 'import'),
350 (279, (1, 'generators')))),
351 (4, ''))),
352 (264,
353 (285,
354 (259,
355 (1, 'def'),
356 (1, 'f'),
357 (260, (7, '('), (8, ')')),
358 (11, ':'),
359 (291,
360 (4, ''),
361 (5, ''),
362 (264,
363 (265,
364 (266,
365 (272,
366 (275,
367 (1, 'return'),
368 (313,
369 (292,
370 (293,
371 (294,
372 (295,
373 (297,
374 (298,
375 (299,
376 (300,
377 (301,
378 (302, (303, (304, (305, (2, '1')))))))))))))))))),
379 (264,
380 (265,
381 (266,
382 (272,
383 (276,
384 (1, 'yield'),
385 (313,
386 (292,
387 (293,
388 (294,
389 (295,
390 (297,
391 (298,
392 (299,
393 (300,
394 (301,
395 (302,
396 (303, (304, (305, (2, '1')))))))))))))))))),
397 (4, ''))),
398 (6, ''))))),
399 (4, ''),
400 (0, ''))))
401 self.check_bad_tree(tree, "def f():\n return 1\n yield 1")
402
Fred Drake58422e52001-06-04 03:56:24 +0000403 def test_print_chevron_comma(self):
Guido van Rossum32c2ae72002-08-22 19:45:32 +0000404 # Illegal input: print >>fp,
Fred Drake58422e52001-06-04 03:56:24 +0000405 tree = \
406 (257,
407 (264,
408 (265,
409 (266,
410 (268,
411 (1, 'print'),
412 (35, '>>'),
413 (290,
414 (291,
415 (292,
416 (293,
417 (295,
418 (296,
419 (297,
420 (298, (299, (300, (301, (302, (303, (1, 'fp')))))))))))))),
421 (12, ','))),
422 (4, ''))),
423 (0, ''))
424 self.check_bad_tree(tree, "print >>fp,")
425
426 def test_a_comma_comma_c(self):
Guido van Rossum32c2ae72002-08-22 19:45:32 +0000427 # Illegal input: a,,c
Fred Drake58422e52001-06-04 03:56:24 +0000428 tree = \
429 (258,
430 (311,
431 (290,
432 (291,
433 (292,
434 (293,
435 (295,
436 (296,
437 (297,
438 (298, (299, (300, (301, (302, (303, (1, 'a')))))))))))))),
439 (12, ','),
440 (12, ','),
441 (290,
442 (291,
443 (292,
444 (293,
445 (295,
446 (296,
447 (297,
448 (298, (299, (300, (301, (302, (303, (1, 'c'))))))))))))))),
449 (4, ''),
450 (0, ''))
451 self.check_bad_tree(tree, "a,,c")
452
453 def test_illegal_operator(self):
Guido van Rossum32c2ae72002-08-22 19:45:32 +0000454 # Illegal input: a $= b
Fred Drake58422e52001-06-04 03:56:24 +0000455 tree = \
456 (257,
457 (264,
458 (265,
459 (266,
460 (267,
461 (312,
462 (291,
463 (292,
464 (293,
465 (294,
466 (296,
467 (297,
468 (298,
469 (299,
470 (300, (301, (302, (303, (304, (1, 'a'))))))))))))))),
471 (268, (37, '$=')),
472 (312,
473 (291,
474 (292,
475 (293,
476 (294,
477 (296,
478 (297,
479 (298,
480 (299,
481 (300, (301, (302, (303, (304, (1, 'b'))))))))))))))))),
482 (4, ''))),
483 (0, ''))
484 self.check_bad_tree(tree, "a $= b")
Fred Drake79ca79d2000-08-21 22:30:53 +0000485
Neal Norwitz9caf9c02003-02-10 01:54:06 +0000486 def test_malformed_global(self):
487 #doesn't have global keyword in ast
488 tree = (257,
489 (264,
490 (265,
491 (266,
492 (282, (1, 'foo'))), (4, ''))),
493 (4, ''),
Tim Petersf2715e02003-02-19 02:35:07 +0000494 (0, ''))
Neal Norwitz9caf9c02003-02-10 01:54:06 +0000495 self.check_bad_tree(tree, "malformed global ast")
Fred Drake79ca79d2000-08-21 22:30:53 +0000496
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000497
498class CompileTestCase(unittest.TestCase):
499
500 # These tests are very minimal. :-(
501
502 def test_compile_expr(self):
503 st = parser.expr('2 + 3')
504 code = parser.compilest(st)
505 self.assertEquals(eval(code), 5)
506
507 def test_compile_suite(self):
508 st = parser.suite('x = 2; y = x + 3')
509 code = parser.compilest(st)
510 globs = {}
511 exec code in globs
512 self.assertEquals(globs['y'], 5)
513
514 def test_compile_error(self):
515 st = parser.suite('1 = 3 + 4')
516 self.assertRaises(SyntaxError, parser.compilest, st)
517
Guido van Rossumb6ac23c2007-07-18 17:19:14 +0000518 def test_compile_badunicode(self):
519 st = parser.suite('a = u"\U12345678"')
520 self.assertRaises(SyntaxError, parser.compilest, st)
521 st = parser.suite('a = u"\u1"')
522 self.assertRaises(SyntaxError, parser.compilest, st)
523
Facundo Batistafc2d0102008-02-23 12:01:13 +0000524class ParserStackLimitTestCase(unittest.TestCase):
525 """try to push the parser to/over it's limits.
526 see http://bugs.python.org/issue1881 for a discussion
527 """
528 def _nested_expression(self, level):
529 return "["*level+"]"*level
530
531 def test_deeply_nested_list(self):
532 e = self._nested_expression(99)
533 st = parser.expr(e)
534 st.compile()
535
536 def test_trigger_memory_error(self):
537 e = self._nested_expression(100)
Martin v. Löwis66e26632008-03-18 13:16:05 +0000538 print >>sys.stderr, "Expecting 's_push: parser stack overflow' in next line"
Facundo Batistafc2d0102008-02-23 12:01:13 +0000539 self.assertRaises(MemoryError, parser.expr, e)
540
Fred Drake2e2be372001-09-20 21:33:42 +0000541def test_main():
Walter Dörwald21d3a322003-05-01 17:45:56 +0000542 test_support.run_unittest(
543 RoundtripLegalSyntaxTestCase,
Jeremy Hylton3e0055f2005-10-20 19:59:25 +0000544 IllegalSyntaxTestCase,
545 CompileTestCase,
Facundo Batistafc2d0102008-02-23 12:01:13 +0000546 ParserStackLimitTestCase,
Walter Dörwald21d3a322003-05-01 17:45:56 +0000547 )
Fred Drake2e2be372001-09-20 21:33:42 +0000548
549
550if __name__ == "__main__":
551 test_main()