From 1873c0e51918ac7d8904ccdfa3f9aec85a11753a Mon Sep 17 00:00:00 2001
From: yasondinalt <yason.bad@gmail.com>
Date: Mon, 4 Apr 2016 20:37:51 +0300
Subject: [PATCH] tests: format float to Decimal with proper rounding
---
tests/model_fields/test_decimalfield.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/model_fields/test_decimalfield.py b/tests/model_fields/test_decimalfield.py
index af9bd6c..fb00b7c 100644
a
|
b
|
class DecimalFieldTests(TestCase):
|
25 | 25 | f = models.DecimalField(max_digits=5, decimal_places=1) |
26 | 26 | self.assertEqual(f._format(f.to_python(2)), '2.0') |
27 | 27 | self.assertEqual(f._format(f.to_python('2.6')), '2.6') |
| 28 | self.assertEqual(f._format(f.to_python(2.15)), '2.2') |
| 29 | self.assertEqual(f._format(f.to_python(2.25)), '2.3') |
28 | 30 | self.assertEqual(f._format(None), None) |
29 | 31 | |
30 | 32 | def test_get_db_prep_lookup(self): |
31 | 33 | f = models.DecimalField(max_digits=5, decimal_places=1) |
32 | 34 | self.assertEqual(f.get_db_prep_lookup('exact', None, connection=connection), [None]) |