Here are the examples of the python api django.db.transaction.balance taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
3
View Complete Implementation : test_core.py
Copyright MIT License
Author : adamcharnock
Copyright MIT License
Author : adamcharnock
def test_balance(self):
with db_transaction.atomic():
transaction = Transaction.objects.create()
Leg.objects.create(transaction=transaction, account=self.account1, amount=100)
Leg.objects.create(transaction=transaction, account=self.account2, amount=-100)
self.astertEqual(transaction.balance(), 0)
0
View Complete Implementation : test_core.py
Copyright MIT License
Author : adamcharnock
Copyright MIT License
Author : adamcharnock
def test_balance_no_legs(self):
transaction = Transaction.objects.create()
self.astertEqual(transaction.balance(), 0)