mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Add test for command summary
with :all
hint
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
90081afb97
commit
2906f36830
1 changed files with 24 additions and 2 deletions
|
@ -27,11 +27,10 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# Ensure python finds the local simpletap module
|
# Ensure python finds the local simpletap module
|
||||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
@ -155,6 +154,29 @@ W10 2017-03-09 Thu @4 Tag1 8:43:08 9:38:15 0:55:07
|
||||||
1:09:03
|
1:09:03
|
||||||
""", out)
|
""", out)
|
||||||
|
|
||||||
|
def test_with_all_hint(self):
|
||||||
|
"""Summary should work with :all hint"""
|
||||||
|
now = datetime.now()
|
||||||
|
yesterday = now - timedelta(days=1)
|
||||||
|
tomorrow = now + timedelta(days=1)
|
||||||
|
|
||||||
|
self.t("track {0:%Y-%m-%d}T10:00:00 - {0:%Y-%m-%d}T11:00:00 FOO".format(yesterday))
|
||||||
|
self.t("track {0:%Y-%m-%d}T10:00:00 - {0:%Y-%m-%d}T11:00:00 BAR".format(now))
|
||||||
|
self.t("track {0:%Y-%m-%d}T10:00:00 - {0:%Y-%m-%d}T11:00:00 BAZ".format(tomorrow))
|
||||||
|
|
||||||
|
code, out, err = self.t("summary :ids :all")
|
||||||
|
|
||||||
|
self.assertIn("""
|
||||||
|
Wk Date Day ID Tags Start End Time Total
|
||||||
|
--- ---------- --- -- ---- -------- -------- ------- -------
|
||||||
|
W{3} {0:%Y-%m-%d} {0:%a} @3 FOO 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
|
W{4} {1:%Y-%m-%d} {1:%a} @2 BAR 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
|
W{5} {2:%Y-%m-%d} {2:%a} @1 BAZ 10:00:00 11:00:00 1:00:00 1:00:00
|
||||||
|
|
||||||
|
3:00:00
|
||||||
|
""".format(yesterday, now, tomorrow,
|
||||||
|
yesterday.isocalendar()[1], now.isocalendar()[1], tomorrow.isocalendar()[1]), out)
|
||||||
|
|
||||||
def test_with_day_gap(self):
|
def test_with_day_gap(self):
|
||||||
"""Summary should skip days with no data"""
|
"""Summary should skip days with no data"""
|
||||||
self.t("track 2017-03-09T10:00:00 - 2017-03-09T11:00:00")
|
self.t("track 2017-03-09T10:00:00 - 2017-03-09T11:00:00")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue