aboutsummaryrefslogtreecommitdiff
path: root/budget/tests.py
diff options
context:
space:
mode:
authorJocelynDelalande <JocelynDelalande@users.noreply.github.com>2017-01-21 14:44:58 +0100
committerGitHub <noreply@github.com>2017-01-21 14:44:58 +0100
commit67331dcf2ac0020d76f9f084aea45aacf4ba2410 (patch)
tree092d31a64e91fea424fd22bf3b5bd517fe295c3c /budget/tests.py
parent963fcf0af130caedc4a6c05c76f20ffa5cbbcfc3 (diff)
parent58aebf10698e0f34102819a21e5b0e511d4190b4 (diff)
downloadihatemoney-mirror-67331dcf2ac0020d76f9f084aea45aacf4ba2410.zip
ihatemoney-mirror-67331dcf2ac0020d76f9f084aea45aacf4ba2410.tar.gz
ihatemoney-mirror-67331dcf2ac0020d76f9f084aea45aacf4ba2410.tar.bz2
Merge pull request #155 from aavenel/fix-test-rounding
Fix unit test rounding
Diffstat (limited to 'budget/tests.py')
-rw-r--r--budget/tests.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/budget/tests.py b/budget/tests.py
index 0e40825..2ee3d81 100644
--- a/budget/tests.py
+++ b/budget/tests.py
@@ -498,7 +498,10 @@ class BudgetTestCase(TestCase):
result[models.Project.query.get("raclette").members[0].id] = 8.12
result[models.Project.query.get("raclette").members[1].id] = 0.0
result[models.Project.query.get("raclette").members[2].id] = -8.12
- self.assertDictEqual(balance, result)
+ # Since we're using floating point to store currency, we can have some rounding issues that prevent test from working.
+ # However, we should obtain the same values as the theorical ones if we round to 2 decimals, like in the UI.
+ for key, value in balance.iteritems():
+ self.assertEqual(round(value, 2), result[key])
def test_edit_project(self):
# A project should be editable