mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
python: test convert utils
This commit is contained in:
parent
ca39ae2db7
commit
e240361494
|
@ -1,4 +1,3 @@
|
||||||
from ..data import Event
|
|
||||||
from ..data import UserDataEvent
|
from ..data import UserDataEvent
|
||||||
from ..enums import ChannelType
|
from ..enums import ChannelType
|
||||||
from ..enums import EventType
|
from ..enums import EventType
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "bbgo"
|
name = "bbgo"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["なるみ <weaper@gmail.com>"]
|
authors = ["なるみ <weaper@gmail.com>"]
|
||||||
packages = [
|
packages = [
|
||||||
|
|
18
python/tests/test_utils.py
Normal file
18
python/tests/test_utils.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
from bbgo.utils import parse_float
|
||||||
|
from bbgo.utils import parse_time
|
||||||
|
|
||||||
|
|
||||||
|
def test_parse_time():
|
||||||
|
t = 1650610080000
|
||||||
|
d = parse_time(t)
|
||||||
|
|
||||||
|
assert d.timestamp() == t / 1000
|
||||||
|
|
||||||
|
|
||||||
|
def test_parse_float():
|
||||||
|
assert parse_float(None) == 0
|
||||||
|
assert parse_float("") == 0
|
||||||
|
|
||||||
|
s = "3.14159265358979"
|
||||||
|
f = 3.14159265358979
|
||||||
|
assert parse_float(s) == f
|
Loading…
Reference in New Issue
Block a user