forked from freqtrade/freqtrade
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gcarq
committed
Nov 11, 2017
1 parent
8f817a3
commit d3b3370
Showing
4 changed files
with
56 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# pragma pylint: disable=missing-docstring | ||
import time | ||
|
||
from freqtrade.misc import throttle | ||
|
||
|
||
def test_throttle(): | ||
|
||
def func(): | ||
return 42 | ||
|
||
start = time.time() | ||
result = throttle(func, 0.1) | ||
end = time.time() | ||
|
||
assert result == 42 | ||
assert end - start > 0.1 | ||
|
||
result = throttle(func, -1) | ||
assert result == 42 |