From 8249c5b38237172152835784bda2b55c2c7a672e Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 21 Jan 2017 13:06:52 -0500 Subject: [PATCH] Added a missing floatformat test and simplified another. --- tests/template_tests/filter_tests/test_floatformat.py | 10 ++++------ 1 file 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 e0f7666ff0d..cfc3eaf73b2 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: