Skip to content

Commit

Permalink
test(logging): add timedict test (#1969)
Browse files Browse the repository at this point in the history
* test(logging): add timedict test

* test(logging): fix quote
  • Loading branch information
Yongxuanzhang committed Feb 19, 2021
1 parent e758803 commit 0f2dc89
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/unit/logging/test_logging_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import time

from jina.logging.profile import TimeDict


def test_logging_profile_timedict():
td = TimeDict()
td('timer')
with td:
time.sleep(2)

assert int(td.accum_time['timer']) == 2
assert str(td) == 'timer: 2.0s'

td.reset()
assert len(td.accum_time) == 0
assert len(td.first_start_time) == 0
assert len(td.start_time) == 0
assert len(td.end_time) == 0

0 comments on commit 0f2dc89

Please sign in to comment.