summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_locale.py
diff options
context:
space:
mode:
authorGarvit Khatri <garvit.khatri@zomato.com>2017-03-28 15:43:38 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2017-03-28 15:43:38 (GMT)
commit1cf93a76c2cf307f2e1e514a8944864f746337ea (patch)
tree85c7a1a948d17182efeaf6e6405ac64105f87f99 /Lib/test/test_locale.py
parentc8fa45bac2942accdb24dde318f87c9eb21dbfde (diff)
downloadcpython-1cf93a76c2cf307f2e1e514a8944864f746337ea.zip
cpython-1cf93a76c2cf307f2e1e514a8944864f746337ea.tar.gz
cpython-1cf93a76c2cf307f2e1e514a8944864f746337ea.tar.bz2
bpo-10379: add 'monetary' to format_string, deprecate format
Add the 'monetary' parameter to format_string so that all uses of format can be converted to format_string. Adjust the documentation accordingly, and add a deprecation warning when format is used.
Diffstat (limited to 'Lib/test/test_locale.py')
-rw-r--r--Lib/test/test_locale.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py
index 99fab58..06d2866 100644
--- a/Lib/test/test_locale.py
+++ b/Lib/test/test_locale.py
@@ -3,6 +3,7 @@ import unittest
import locale
import sys
import codecs
+import warnings
class BaseLocalizedTest(unittest.TestCase):
#
@@ -197,6 +198,10 @@ class EnUSNumberFormatting(BaseFormattingTest):
self._test_format("%+10.f", -4200, grouping=0, out='-4200'.rjust(10))
self._test_format("%-10.f", 4200, grouping=0, out='4200'.ljust(10))
+ def test_format_deprecation(self):
+ with self.assertWarns(DeprecationWarning):
+ locale.format("%-10.f", 4200, grouping=True)
+
def test_complex_formatting(self):
# Spaces in formatting string
self._test_format_string("One million is %i", 1000000, grouping=1,