tests flake8 issues

added some doc
This commit is contained in:
euri10 2017-01-28 21:40:26 +01:00
parent 868746bb51
commit 8d054f3656
2 changed files with 26 additions and 3 deletions

View file

@ -162,6 +162,20 @@ Dates are written separated by hyphens, like ``year-month-day``, but the month
and day are optional. If you leave out the day, for example, you will get
matches for the whole month.
You can also use relative dates to the current time.
Relative dates begin by the ``@`` character, followed by an optional ``+`` or
``-`` sign that will increment or decrement now, followed by the time quantity
that will be represented as an integer followed by either ``d`` for days, ``w``
for weeks, ``m`` for months and finally ``y`` for year.
Here is an example that finds all the albums added between now and last week::
$ beet ls -a 'added:@-1w..@0d'
Find all items added in a 2 weeks period 4 weeks ago::
$ beet ls -a 'added:@-6w..@-2w'
Date *intervals*, like the numeric intervals described above, are separated by
two dots (``..``). You can specify a start, an end, or both.
@ -186,6 +200,7 @@ Find all items with a file modification time between 2008-12-01 and
$ beet ls 'mtime:2008-12-01..2008-12-02'
.. _not_query:
Query Term Negation

View file

@ -123,6 +123,7 @@ class DateQueryTest(_common.LibTestCase):
matched = self.lib.items(query)
self.assertEqual(len(matched), 0)
class DateQueryTestRelative(_common.LibTestCase):
def setUp(self):
super(DateQueryTestRelative, self).setUp()
@ -135,7 +136,9 @@ class DateQueryTestRelative(_common.LibTestCase):
self.assertEqual(len(matched), 1)
def test_single_month_nonmatch_fast(self):
query = DateQuery('added', (datetime.now()+relativedelta(months=1)).strftime('%Y-%m'))
query = DateQuery('added',
(datetime.now() + relativedelta(months=1)).strftime(
'%Y-%m'))
matched = self.lib.items(query)
self.assertEqual(len(matched), 0)
@ -144,7 +147,9 @@ class DateQueryTestRelative(_common.LibTestCase):
self.assertTrue(query.match(self.i))
def test_single_month_nonmatch_slow(self):
query = DateQuery('added', (datetime.now()+relativedelta(months=1)).strftime('%Y-%m'))
query = DateQuery('added',
(datetime.now() + relativedelta(months=1)).strftime(
'%Y-%m'))
self.assertFalse(query.match(self.i))
def test_single_day_match_fast(self):
@ -153,10 +158,13 @@ class DateQueryTestRelative(_common.LibTestCase):
self.assertEqual(len(matched), 1)
def test_single_day_nonmatch_fast(self):
query = DateQuery('added', (datetime.now()+ relativedelta(days=1)).strftime('%Y-%m-%d'))
query = DateQuery('added',
(datetime.now() + relativedelta(days=1)).strftime(
'%Y-%m-%d'))
matched = self.lib.items(query)
self.assertEqual(len(matched), 0)
class DateQueryConstructTest(unittest.TestCase):
def test_long_numbers(self):
DateQuery('added', '1409830085..1412422089')