From 23d5343a092eab207785bd9b780386b546d0c7d3 Mon Sep 17 00:00:00 2001 From: Tatuya Kamada <tatuya@nexedi.com> Date: Tue, 22 Oct 2013 16:09:34 +0900 Subject: [PATCH] Unit Test: Make sure how FloatFiled rounding. --- product/ERP5Form/tests/testFields.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/product/ERP5Form/tests/testFields.py b/product/ERP5Form/tests/testFields.py index 56ac049ff4..bb8f5089a7 100644 --- a/product/ERP5Form/tests/testFields.py +++ b/product/ERP5Form/tests/testFields.py @@ -110,6 +110,15 @@ class TestFloatField(ERP5TypeTestCase): self.field.values['input_style'] = '-1,234.5' self.field.values['precision'] = 0 self.assertEquals('-1,000', self.widget.format_value(self.field, -1000.25)) + self.assertEquals('-1,000', self.widget.format_value(self.field, -1000.49)) + self.assertEquals('-1,001', self.widget.format_value(self.field, -1000.99)) + self.assertEquals('-1,001', self.widget.format_value(self.field, -1000.80)) + self.assertEquals('-1,001', self.widget.format_value(self.field, -1000.70)) + self.assertEquals('-1,001', self.widget.format_value(self.field, -1000.60)) + self.assertEquals('-1,001', self.widget.format_value(self.field, -1000.59)) + self.assertEquals('-1,001', self.widget.format_value(self.field, -1000.51)) + # this is not -1,001 (is this a specification?) + self.assertEquals('-1,000', self.widget.format_value(self.field, -1000.50)) def test_format_percent_style(self): self.field.values['input_style'] = '-12.3%' -- 2.30.9