예제 #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
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)