Skip to content

Commit 70a5002

Browse files
committed
Add test and adjust version
1 parent 67d7a9c commit 70a5002

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

kernprof.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# NOTE: This version needs to be manually maintained with the line_profiler
1515
# __version__ for now.
16-
__version__ = '4.0.0'
16+
__version__ = '4.0.1'
1717

1818
# Guard the import of cProfile such that 3.x people
1919
# without lsprof can still use this script.

line_profiler/line_profiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
f'Has it been compiled? Underlying error is ex={ex!r}'
1717
)
1818

19-
__version__ = '4.0.0'
19+
__version__ = '4.0.1'
2020

2121

2222
def load_ipython_extension(ip):

tests/test_line_profiler.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ def g(x):
1212
y = yield x + 10
1313
yield y + 20
1414

15+
class C:
16+
@classmethod
17+
def c(self, value):
18+
print(value)
19+
return 0
20+
1521

1622
def test_init():
1723
lp = LineProfiler()
@@ -86,3 +92,13 @@ def test_gen_decorator():
8692
with pytest.raises(StopIteration):
8793
next(i)
8894
assert profile.enable_count == 0
95+
96+
def test_classmethod_decorator():
97+
profile = LineProfiler()
98+
c_wrapped = profile(C.c)
99+
assert c_wrapped.__name__ == 'c'
100+
assert profile.enable_count == 0
101+
val = c_wrapped('test')
102+
assert profile.enable_count == 0
103+
assert val == C.c('test')
104+
assert profile.enable_count == 0

0 commit comments

Comments
 (0)