bpo-38536: locale: Remove trailing space in formatted currency (GH-16864)
This commit is contained in:
parent
d8ef64422a
commit
e96d954527
|
@ -279,6 +279,8 @@ def currency(val, symbol=True, grouping=False, international=False):
|
|||
if precedes:
|
||||
s = smb + (separated and ' ' or '') + s
|
||||
else:
|
||||
if international and smb[-1] == ' ':
|
||||
smb = smb[:-1]
|
||||
s = s + (separated and ' ' or '') + smb
|
||||
|
||||
sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']
|
||||
|
|
|
@ -334,7 +334,6 @@ class TestFrFRNumberFormatting(FrFRCookedTest, BaseFormattingTest):
|
|||
euro = '\u20ac'
|
||||
self._test_currency(50000, "50000,00 " + euro)
|
||||
self._test_currency(50000, "50 000,00 " + euro, grouping=True)
|
||||
# XXX is the trailing space a bug?
|
||||
self._test_currency(50000, "50 000,00 EUR",
|
||||
grouping=True, international=True)
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Removes trailing space in formatted currency with `international=True` and a locale with symbol following value.
|
||||
E.g. `locale.currency(12.34, international=True)` returned `'12,34 EUR '` instead of `'12,34 EUR'`.
|
Loading…
Reference in New Issue