prettify emfit and use common module

This commit is contained in:
Dima Gerasimov 2020-03-06 20:27:50 +00:00
parent 2daa9999fd
commit 55fd26acfc
2 changed files with 46 additions and 51 deletions

23
tests/emfit.py Normal file
View file

@ -0,0 +1,23 @@
from my.emfit import get_datas
def test():
datas = get_datas()
for d in datas:
assert d.start.tzinfo is not None
assert d.end.tzinfo is not None
assert d.sleep_start.tzinfo is not None
assert d.sleep_end.tzinfo is not None
def test_tz():
datas = get_datas()
# this was winter time, so GMT, UTC+0
[s0109] = [s for s in datas if s.date.strftime('%Y%m%d') == '20190109']
assert s0109.end.strftime('%H:%M') == '06:42'
# TODO FIXME ugh, it's broken?...
# summer time, so UTC+1
[s0411] = [s for s in datas if s.date.strftime('%Y%m%d') == '20190411']
assert s0411.end.strftime('%H:%M') == '09:30'