mirror of https://github.com/flaggo/pydu.git
add test for dt.timer
This commit is contained in:
parent
65eca21c7b
commit
28cc8fe90c
|
@ -0,0 +1,23 @@
|
|||
import os
|
||||
from pydu.dt import timer
|
||||
|
||||
|
||||
class TestTimer(object):
|
||||
def test_context_manager(self):
|
||||
timeit = timer()
|
||||
|
||||
with timeit:
|
||||
os.getcwd()
|
||||
|
||||
assert timeit.elapsed is not None
|
||||
|
||||
def test_decorator(self):
|
||||
import sys
|
||||
timeit = timer(print_func=print)
|
||||
|
||||
@timeit
|
||||
def foo():
|
||||
os.getcwd()
|
||||
|
||||
foo()
|
||||
assert timeit.elapsed is not None
|
Loading…
Reference in New Issue