diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py
index 488d6a77cd..c47724126c 100644
|
a
|
b
|
def format(
|
| 25 | 25 | module in locale.localeconv() LC_NUMERIC grouping (e.g. (3, 2, 0)). |
| 26 | 26 | * thousand_sep: Thousand separator symbol (for example ",") |
| 27 | 27 | """ |
| | 28 | if number is None: |
| | 29 | return mark_safe(None) |
| | 30 | if number == "": |
| | 31 | return mark_safe("") |
| 28 | 32 | use_grouping = ( |
| 29 | 33 | use_l10n or (use_l10n is None and settings.USE_L10N) |
| 30 | 34 | ) and settings.USE_THOUSAND_SEPARATOR |
diff --git a/tests/utils_tests/test_numberformat.py b/tests/utils_tests/test_numberformat.py
index cec3e4c385..e521b43f96 100644
|
a
|
b
|
class TestNumberFormat(SimpleTestCase):
|
| 172 | 172 | |
| 173 | 173 | price = EuroDecimal("1.23") |
| 174 | 174 | self.assertEqual(nformat(price, ","), "€ 1,23") |
| | 175 | |
| | 176 | def test_empty(self): |
| | 177 | self.assertEqual(nformat(None, "."), "None") |
| | 178 | self.assertEqual(nformat("", "."), "") |