blob: 455fa1c5f14a68aaf11e3a5a8264f24f3947fa95 (
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
25
26
27
28
29
|
"""
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 getfname(func):
fname = os.path.basename(func.func_globals['__file__'])
return os.path.splitext(fname)[0] + '.py'
def test0():
this = getfname(identity)
assert this == 'test.py', this
print(identity.__doc__)
def test1():
this = getfname(f1)
assert this == 'test.py', this
print(f1.__doc__)
|