コード例 #1
0
def test_interval_tuples():
    assert interval_tuples(date(2014, 3, 5), date(2014, 5, 5), 'month') == [
        (date(2014, 3, 5), date(2014, 4, 1)),
        (date(2014, 4, 1), date(2014, 5, 1)),
        (date(2014, 5, 1), date(2014, 6, 1)),
    ]
    assert interval_tuples(date(2014, 3, 5), date(2014, 5, 5), 'year') == [
        (date(2014, 3, 5), date(2015, 1, 1)),
    ]
    assert interval_tuples(date(2014, 1, 1), date(2015, 1, 1), 'year') == [
        (date(2014, 1, 1), date(2015, 1, 1)),
    ]
    assert interval_tuples(None, None, None) == []
コード例 #2
0
ファイル: test_util_date.py プロジェクト: redstreet/fava
def test_interval_tuples():
    assert interval_tuples(date(2014, 3, 5), date(2014, 5, 5), 'month') == [
        (date(2014, 3, 5), date(2014, 4, 1)),
        (date(2014, 4, 1), date(2014, 5, 1)),
        (date(2014, 5, 1), date(2014, 6, 1)),
    ]
    assert interval_tuples(date(2014, 3, 5), date(2014, 5, 5), 'year') == [
        (date(2014, 3, 5), date(2015, 1, 1)),
    ]
    assert interval_tuples(date(2014, 1, 1), date(2015, 1, 1), 'year') == [
        (date(2014, 1, 1), date(2015, 1, 1)),
    ]
    assert interval_tuples(None, None, None) == []
コード例 #3
0
ファイル: __init__.py プロジェクト: tichai/fava
 def _interval_tuples(self, interval):
     """Calculates tuples of (begin_date, end_date) of length interval for the
     period in which entries contains transactions.  """
     return date.interval_tuples(self._date_first, self._date_last,
                                 interval)
コード例 #4
0
ファイル: __init__.py プロジェクト: yagebu/fava
 def _interval_tuples(self, interval):
     """Calculates tuples of (begin_date, end_date) of length interval for the
     period in which entries contains transactions.  """
     return date.interval_tuples(self.date_first, self.date_last, interval)