]> asedeno.scripts.mit.edu Git - bluechips.git/commitdiff
Use self.assert* functions in tests instead of normal assertion
authorEvan Broder <broder@mit.edu>
Sun, 20 Jul 2008 14:52:54 +0000 (14:52 +0000)
committerEvan Broder <broder@mit.edu>
Sun, 20 Jul 2008 14:52:54 +0000 (14:52 +0000)
bluechips/tests/splits/test_fixed.py
bluechips/tests/splits/test_random.py

index 1927f6e910d81b9f7f7b5aa8760e93614df39412..dfa415e22bec86f98c063dedab928d504189cdcd 100644 (file)
@@ -3,6 +3,7 @@ from bluechips.tests import *
 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):
@@ -17,8 +18,7 @@ class TestSplitFixed(TestCase):
         
         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()
index 9d9314a15915b2dede303e2b1bb903db21f4478f..566c14f33c0741ae037b27b005fe042061f067d0 100644 (file)
@@ -21,11 +21,10 @@ class TestSplitRandom(TestCase):
     
     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")