mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
Fix unit test rounding :
Test was Ok but failed due to some floating point errors.
This commit is contained in:
parent
963fcf0af1
commit
58aebf1069
1 changed files with 4 additions and 1 deletions
|
@ -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[0].id] = 8.12
|
||||||
result[models.Project.query.get("raclette").members[1].id] = 0.0
|
result[models.Project.query.get("raclette").members[1].id] = 0.0
|
||||||
result[models.Project.query.get("raclette").members[2].id] = -8.12
|
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):
|
def test_edit_project(self):
|
||||||
# A project should be editable
|
# A project should be editable
|
||||||
|
|
Loading…
Reference in a new issue