File diff e00ec95d93bd → c6dc2d83aca7
tests/test_data_balance_of.py
Show inline comments
...
 
@@ -34,23 +34,6 @@ def payable_payment_txn():
 
        ('Assets:Checking', -5),
 
    ])
 

	
 
@pytest.fixture
 
def none_posting_txn():
 
    return testutil.Transaction(postings=[
 
        ('Income:Donations', -30),
 
        ('Expenses:BankingFees', 3),
 
        ('Assets:Checking', None),
 
    ])
 

	
 
@pytest.fixture
 
def multipost_one_none_txn():
 
    return testutil.Transaction(postings=[
 
        ('Liabilities:Payable:Accounts', 50),
 
        ('Assets:Checking', -50),
 
        ('Expenses:BankingFees', 5),
 
        ('Assets:Checking', None),
 
    ])
 

	
 
def balance_under(txn, *accts):
 
    pred = methodcaller('is_under', *accts)
 
    return data.balance_of(txn, pred)
...
 
@@ -82,25 +65,3 @@ def test_multiarg_balance_of():
 

	
 
def test_balance_of_multipost_txn(payable_payment_txn):
 
    assert data.balance_of(payable_payment_txn, is_cash_eq) == -55
 

	
 
def test_balance_of_none_posting(none_posting_txn):
 
    assert data.balance_of(none_posting_txn, is_cash_eq) is None
 

	
 
def test_balance_of_none_posting_with_default(none_posting_txn):
 
    expected = Decimal('Infinity')
 
    assert expected == data.balance_of(
 
        none_posting_txn, is_cash_eq, default=expected,
 
    )
 

	
 
def test_balance_of_other_side_of_none_posting(none_posting_txn):
 
    assert balance_under(none_posting_txn, 'Income') == -30
 
    assert balance_under(none_posting_txn, 'Expenses') == 3
 

	
 
def test_balance_of_multi_postings_one_none(multipost_one_none_txn):
 
    assert data.balance_of(multipost_one_none_txn, is_cash_eq) is None
 

	
 
def test_balance_of_multi_postings_one_none(multipost_one_none_txn):
 
    expected = Decimal('Infinity')
 
    assert expected == data.balance_of(
 
        multipost_one_none_txn, is_cash_eq, default=expected,
 
    )