tests: Promote date_seq to testutil.
This commit is contained in:
parent
8d584734ec
commit
99dbd1ac95
2 changed files with 6 additions and 6 deletions
|
@ -27,13 +27,8 @@ from . import testutil
|
||||||
from conservancy_beancount import data
|
from conservancy_beancount import data
|
||||||
from conservancy_beancount.reports import core
|
from conservancy_beancount.reports import core
|
||||||
|
|
||||||
def date_seq(date=testutil.FY_MID_DATE, step=1):
|
|
||||||
while True:
|
|
||||||
yield date
|
|
||||||
date = date + datetime.timedelta(days=step)
|
|
||||||
|
|
||||||
def accruals_and_payments(acct, src_acct, dst_acct, start_date, *amounts):
|
def accruals_and_payments(acct, src_acct, dst_acct, start_date, *amounts):
|
||||||
dates = date_seq(start_date)
|
dates = testutil.date_seq(start_date)
|
||||||
for amt, currency in amounts:
|
for amt, currency in amounts:
|
||||||
yield testutil.Transaction(date=next(dates), postings=[
|
yield testutil.Transaction(date=next(dates), postings=[
|
||||||
(acct, amt, currency),
|
(acct, amt, currency),
|
||||||
|
|
|
@ -55,6 +55,11 @@ def combine_values(*value_seqs):
|
||||||
stop,
|
stop,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def date_seq(date=FY_MID_DATE, step=1):
|
||||||
|
while True:
|
||||||
|
yield date
|
||||||
|
date += datetime.timedelta(days=step)
|
||||||
|
|
||||||
def parse_date(s, fmt='%Y-%m-%d'):
|
def parse_date(s, fmt='%Y-%m-%d'):
|
||||||
return datetime.datetime.strptime(s, fmt).date()
|
return datetime.datetime.strptime(s, fmt).date()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue