from bluechips import model
from bluechips.model import meta
from bluechips.model.types import Currency
+from decimal import Decimal
class TestSplitFixed(TestCase):
def test_simpleSplit(self):
for s in meta.Session.query(model.Split).\
filter(model.Split.expenditure==e):
- assert s.share == Currency("25.00"), \
- "$100 expenditure did not split evenly"
+ self.assertEqual(s.share, Currency("25.00"))
deleteExpenditures()
deleteUsers()
def test_splitTotal(self):
for e in meta.Session.query(model.Expenditure):
- assert sum(s.share for s in e.splits) == e.amount,\
- "Total of splits is not the same as the expenditure total"
+ self.assertEqual(sum(s.share for s in e.splits), e.amount)
def test_splitDistribution(self):
for e in meta.Session.query(model.Expenditure):
even_total = (e.amount / meta.Session.query(model.User).count())
- assert std_dev(list(s.share for s in e.splits)) <= even_total, \
- "Expenditure doesn't appear to be evenly distributed"
+ self.assert_(std_dev(list(s.share for s in e.splits)) <= even_total, \
+ "Expenditure doesn't appear to be evenly distributed")