python: test convert utils

This commit is contained in:
なるみ 2022-04-22 15:00:40 +08:00
parent ca39ae2db7
commit e240361494
3 changed files with 19 additions and 2 deletions

View File

@ -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

View File

@ -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 = [

View 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