File: TestDecorators.py

package info (click to toggle)
cython 0.15.1-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 16,480 kB
  • sloc: python: 45,354; xml: 1,031; cpp: 635; makefile: 229; lisp: 48; ansic: 28
file content (25 lines) | stat: -rw-r--r-- 610 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import unittest
from Cython.TestUtils import TransformTest
from Cython.Compiler.ParseTreeTransforms import DecoratorTransform

class TestDecorator(TransformTest):

    def test_decorator(self):
        t = self.run_pipeline([DecoratorTransform(None)], u"""
        def decorator(fun):
            return fun
        @decorator
        def decorated():
            pass
        """)

        self.assertCode(u"""
        def decorator(fun):
            return fun
        def decorated():
            pass
        decorated = decorator(decorated)
        """, t)

if __name__ == '__main__':
    unittest.main()