diff options
Diffstat (limited to 'tests/forms_tests/field_tests/test_floatfield.py')
| -rw-r--r-- | tests/forms_tests/field_tests/test_floatfield.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/forms_tests/field_tests/test_floatfield.py b/tests/forms_tests/field_tests/test_floatfield.py index d97bbfc13e..d6dffaccb1 100644 --- a/tests/forms_tests/field_tests/test_floatfield.py +++ b/tests/forms_tests/field_tests/test_floatfield.py @@ -1,8 +1,9 @@ from django.core.exceptions import ValidationError from django.forms import FloatField, NumberInput from django.test import SimpleTestCase -from django.test.utils import override_settings +from django.test.utils import ignore_warnings, override_settings from django.utils import formats, translation +from django.utils.deprecation import RemovedInDjango50Warning from . import FormFieldAssertionsMixin @@ -81,17 +82,27 @@ class FloatFieldTest(FormFieldAssertionsMixin, SimpleTestCase): n = 4.35 self.assertFalse(f.has_changed(n, '4.3500')) - with translation.override('fr'), self.settings(USE_L10N=True): + with translation.override('fr'): f = FloatField(localize=True) localized_n = formats.localize_input(n) # -> '4,35' in French self.assertFalse(f.has_changed(n, localized_n)) + # RemovedInDjango50Warning: When the deprecation ends, remove + # @ignore_warnings and USE_L10N=False. The test should remain because + # format-related settings will take precedence over locale-dictated + # formats. + @ignore_warnings(category=RemovedInDjango50Warning) @override_settings(USE_L10N=False, DECIMAL_SEPARATOR=',') def test_decimalfield_support_decimal_separator(self): f = FloatField(localize=True) self.assertEqual(f.clean('1001,10'), 1001.10) self.assertEqual(f.clean('1001.10'), 1001.10) + # RemovedInDjango50Warning: When the deprecation ends, remove + # @ignore_warnings and USE_L10N=False. The test should remain because + # format-related settings will take precedence over locale-dictated + # formats. + @ignore_warnings(category=RemovedInDjango50Warning) @override_settings(USE_L10N=False, DECIMAL_SEPARATOR=',', USE_THOUSAND_SEPARATOR=True, THOUSAND_SEPARATOR='.') def test_decimalfield_support_thousands_separator(self): |
