Back to index

python3.2  3.2.2
Public Member Functions
test.test_decorators.TestClassDecorators Class Reference

List of all members.

Public Member Functions

def test_simple
def test_double
def test_order

Detailed Description

Definition at line 269 of file test_decorators.py.


Member Function Documentation

Definition at line 279 of file test_decorators.py.

00279 
00280     def test_double(self):
00281         def ten(x):
00282             x.extra = 10
00283             return x
00284         def add_five(x):
00285             x.extra += 5
00286             return x
00287 
00288         @add_five
00289         @ten
00290         class C(object): pass
00291         self.assertEqual(C.extra, 15)

Here is the call graph for this function:

Definition at line 292 of file test_decorators.py.

00292 
00293     def test_order(self):
00294         def applied_first(x):
00295             x.extra = 'first'
00296             return x
00297         def applied_second(x):
00298             x.extra = 'second'
00299             return x
00300         @applied_second
00301         @applied_first
00302         class C(object): pass
00303         self.assertEqual(C.extra, 'second')

Here is the call graph for this function:

Definition at line 271 of file test_decorators.py.

00271 
00272     def test_simple(self):
00273         def plain(x):
00274             x.extra = 'Hello'
00275             return x
00276         @plain
00277         class C(object): pass
00278         self.assertEqual(C.extra, 'Hello')

Here is the call graph for this function:


The documentation for this class was generated from the following file: