~pythonregexp2.7/python/issue2636-09-01+10

« back to all changes in this revision

Viewing changes to Lib/test/test_grammar.py

  • Committer: Jeffrey C. "The TimeHorse" Jacobs
  • Date: 2008-09-22 21:39:45 UTC
  • mfrom: (39055.1.33 Regexp-2.7)
  • Revision ID: darklord@timehorse.com-20080922213945-23717m5eiqpamcyn
Merged in changes from the Single-Loop Engine branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
282
282
        def d32v((x,)): pass
283
283
        d32v((1,))
284
284
 
 
285
        # keyword arguments after *arglist
 
286
        def f(*args, **kwargs):
 
287
            return args, kwargs
 
288
        self.assertEquals(f(1, x=2, *[3, 4], y=5), ((1, 3, 4),
 
289
                                                    {'x':2, 'y':5}))
 
290
        self.assertRaises(SyntaxError, eval, "f(1, *(2,3), 4)")
 
291
        self.assertRaises(SyntaxError, eval, "f(1, x=2, *(3,4), x=5)")
 
292
 
285
293
        # Check ast errors in *args and *kwargs
286
294
        check_syntax_error(self, "f(*g(1=2))")
287
295
        check_syntax_error(self, "f(**g(1=2))")
299
307
        self.assertEquals(l5(1, 2), 5)
300
308
        self.assertEquals(l5(1, 2, 3), 6)
301
309
        check_syntax_error(self, "lambda x: x = 2")
 
310
        check_syntax_error(self, "lambda (None,): None")
302
311
 
303
312
    ### stmt: simple_stmt | compound_stmt
304
313
    # Tested below