diff options
author | Tim Graham <timograham@gmail.com> | 2017-01-21 13:06:52 -0500 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-01-21 13:06:52 -0500 |
commit | 8249c5b38237172152835784bda2b55c2c7a672e (patch) | |
tree | e5a8c39d19fd16391ed66fd3d9340ca74bd6549f /tests/template_tests/filter_tests | |
parent | a76d12ceb437a68efb6a19a588fb29a7a0e5a5e2 (diff) | |
download | django-8249c5b38237172152835784bda2b55c2c7a672e.tar.gz |
Added a missing floatformat test and simplified another.
Diffstat (limited to 'tests/template_tests/filter_tests')
-rw-r--r-- | tests/template_tests/filter_tests/test_floatformat.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/template_tests/filter_tests/test_floatformat.py b/tests/template_tests/filter_tests/test_floatformat.py index e0f7666ff0..cfc3eaf73b 100644 --- a/tests/template_tests/filter_tests/test_floatformat.py +++ b/tests/template_tests/filter_tests/test_floatformat.py @@ -29,6 +29,7 @@ class FunctionTests(SimpleTestCase): self.assertEqual(floatformat(0.07), '0.1') self.assertEqual(floatformat(0.007), '0.0') self.assertEqual(floatformat(0.0), '0') + self.assertEqual(floatformat(7.7, 0), '8') self.assertEqual(floatformat(7.7, 3), '7.700') self.assertEqual(floatformat(6.000000, 3), '6.000') self.assertEqual(floatformat(6.200000, 3), '6.200') @@ -63,13 +64,10 @@ class FunctionTests(SimpleTestCase): def test_infinity(self): pos_inf = float(1e30000) - self.assertEqual(floatformat(pos_inf), str(pos_inf)) - neg_inf = float(-1e30000) - self.assertEqual(floatformat(neg_inf), str(neg_inf)) - - nan = pos_inf / pos_inf - self.assertEqual(floatformat(nan), str(nan)) + self.assertEqual(floatformat(pos_inf), 'inf') + self.assertEqual(floatformat(neg_inf), '-inf') + self.assertEqual(floatformat(pos_inf / pos_inf), 'nan') def test_float_dunder_method(self): class FloatWrapper: |