Anton Shestakov <av6@dwimlabs.net>, Sun, 24 Sep 2017 12:25:05 +0800
viewer: use subqueries to get data on index page
Before, there were bare columns in the aggregate query, their values were
undefined (but it somehow worked), as SQLite docs say. Good news is that now
this bigger query uses (project_id, ordinal) index and is really fast.
tests/test_utils.py
Permissions: -rw-r--r--
from argparse import Namespace from datetime import datetime from candolint.utils import parse_timestamp, timestamp, lookup_option def test_timestamp_and_parse(): result = parse_timestamp(timestamp()) assert isinstance(result, datetime) assert result.utcoffset() is None def test_lookup_option(): assert lo('foo', Namespace(), {}, default='maybe') == 'maybe' assert lo('foo', Namespace(foo='yes'), {}, default='maybe') == 'yes' assert lo('foo', Namespace(foo='yes'), {'foo': 'no'}) == 'yes' assert lo('foo', Namespace(), {'foo': 'no'}, default='maybe') == 'no' assert lo('a-b-c', Namespace(a_b_c=1), {'a-b-c': 2}, default=3) == 1