summaryrefslogtreecommitdiff
path: root/decorator/test.py
blob: 6c24b154821284e0e125ca3623cc1832cbf38dda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""
Some simple tests executable with nose or py.test
"""

import os
from decorator import decorator

@decorator
def identity(f, *a, **k):
    "do nothing decorator"
    return f(*a, **k)

@identity
def f1():
    "f1"

def test0():
    assert os.path.basename(identity.func_globals['__file__']) == 'test.py'
    print(identity.__doc__)

def test1():
    assert os.path.basename(f1.func_globals['__file__']) == 'test.py'
    print(f1.__doc__)