Changeset - 99dbd1ac9596
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-04-22 13:17:58
brettcsmith@brettcsmith.org
tests: Promote date_seq to testutil.
2 files changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
tests/test_reports_related_postings.py
Show inline comments
...
 
@@ -27,13 +27,8 @@ from . import testutil
 
from conservancy_beancount import data
 
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):
 
    dates = date_seq(start_date)
 
    dates = testutil.date_seq(start_date)
 
    for amt, currency in amounts:
 
        yield testutil.Transaction(date=next(dates), postings=[
 
            (acct, amt, currency),
tests/testutil.py
Show inline comments
...
 
@@ -55,6 +55,11 @@ def combine_values(*value_seqs):
 
        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'):
 
    return datetime.datetime.strptime(s, fmt).date()
 

	
0 comments (0 inline, 0 general)