comparison genshi/template/tests/eval.py @ 879:27d210790d27

Looks like the 'decorators' field in the AST was renamed to 'decorator_list' in Python 2.6, so look for both. See #379.
author cmlenz
date Thu, 15 Apr 2010 21:38:21 +0000
parents 9309530ee279
children 248d6671a7e1
comparison
equal deleted inserted replaced
878:abfabaea906f 879:27d210790d27
586 """) 586 """)
587 data = {} 587 data = {}
588 suite.execute(data) 588 suite.execute(data)
589 self.assertEqual(['foo', 'bar'], data['x']) 589 self.assertEqual(['foo', 'bar'], data['x'])
590 590
591 def test_def_with_decorator(self):
592 suite = Suite("""
593 def lower(fun):
594 return lambda: fun().lower()
595
596 @lower
597 def say_hi():
598 return 'Hi!'
599
600 result = say_hi()
601 """)
602 data = {}
603 suite.execute(data)
604 self.assertEqual('hi!', data['result'])
605
591 def test_delete(self): 606 def test_delete(self):
592 suite = Suite("""foo = 42 607 suite = Suite("""foo = 42
593 del foo 608 del foo
594 """) 609 """)
595 data = {} 610 data = {}
Copyright (C) 2012-2017 Edgewall Software