diff options
Diffstat (limited to 'tests/db_functions/math/test_round.py')
| -rw-r--r-- | tests/db_functions/math/test_round.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/db_functions/math/test_round.py b/tests/db_functions/math/test_round.py index a3770f1f52..50345d4b5c 100644 --- a/tests/db_functions/math/test_round.py +++ b/tests/db_functions/math/test_round.py @@ -20,16 +20,16 @@ class RoundTests(TestCase): obj = DecimalModel.objects.annotate(n1_round=Round('n1'), n2_round=Round('n2')).first() self.assertIsInstance(obj.n1_round, Decimal) self.assertIsInstance(obj.n2_round, Decimal) - self.assertAlmostEqual(obj.n1_round, round(obj.n1)) - self.assertAlmostEqual(obj.n2_round, round(obj.n2)) + self.assertAlmostEqual(obj.n1_round, obj.n1, places=0) + self.assertAlmostEqual(obj.n2_round, obj.n2, places=0) def test_float(self): FloatModel.objects.create(f1=-27.55, f2=0.55) obj = FloatModel.objects.annotate(f1_round=Round('f1'), f2_round=Round('f2')).first() self.assertIsInstance(obj.f1_round, float) self.assertIsInstance(obj.f2_round, float) - self.assertAlmostEqual(obj.f1_round, round(obj.f1)) - self.assertAlmostEqual(obj.f2_round, round(obj.f2)) + self.assertAlmostEqual(obj.f1_round, obj.f1, places=0) + self.assertAlmostEqual(obj.f2_round, obj.f2, places=0) def test_integer(self): IntegerModel.objects.create(small=-20, normal=15, big=-1) @@ -41,9 +41,9 @@ class RoundTests(TestCase): self.assertIsInstance(obj.small_round, int) self.assertIsInstance(obj.normal_round, int) self.assertIsInstance(obj.big_round, int) - self.assertEqual(obj.small_round, round(obj.small)) - self.assertEqual(obj.normal_round, round(obj.normal)) - self.assertEqual(obj.big_round, round(obj.big)) + self.assertAlmostEqual(obj.small_round, obj.small, places=0) + self.assertAlmostEqual(obj.normal_round, obj.normal, places=0) + self.assertAlmostEqual(obj.big_round, obj.big, places=0) def test_transform(self): with register_lookup(DecimalField, Round): |
