Skip to content

Commit

Permalink
Add test and adjust version
Browse files Browse the repository at this point in the history
  • Loading branch information
Theelx committed Nov 15, 2022
1 parent 67d7a9c commit 70a5002
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kernprof.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# NOTE: This version needs to be manually maintained with the line_profiler
# __version__ for now.
__version__ = '4.0.0'
__version__ = '4.0.1'

# Guard the import of cProfile such that 3.x people
# without lsprof can still use this script.
Expand Down
2 changes: 1 addition & 1 deletion line_profiler/line_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
f'Has it been compiled? Underlying error is ex={ex!r}'
)

__version__ = '4.0.0'
__version__ = '4.0.1'


def load_ipython_extension(ip):
Expand Down
16 changes: 16 additions & 0 deletions tests/test_line_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ def g(x):
y = yield x + 10
yield y + 20

class C:
@classmethod
def c(self, value):
print(value)
return 0


def test_init():
lp = LineProfiler()
Expand Down Expand Up @@ -86,3 +92,13 @@ def test_gen_decorator():
with pytest.raises(StopIteration):
next(i)
assert profile.enable_count == 0

def test_classmethod_decorator():
profile = LineProfiler()
c_wrapped = profile(C.c)
assert c_wrapped.__name__ == 'c'
assert profile.enable_count == 0
val = c_wrapped('test')
assert profile.enable_count == 0
assert val == C.c('test')
assert profile.enable_count == 0

0 comments on commit 70a5002

Please sign in to comment.