diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-03-18 08:25:36 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-03-18 08:25:36 (GMT) |
commit | 7303b594e62349251cbb9d98141a96885fc88e6f (patch) | |
tree | f38c0d29fab1e3357b65fe9e1c2b91ea5f0a5bb8 /Lib/test/test_decimal.py | |
parent | 79f52039fe181d0f98b056b0b312a9bb42a59526 (diff) | |
download | cpython-7303b594e62349251cbb9d98141a96885fc88e6f.zip cpython-7303b594e62349251cbb9d98141a96885fc88e6f.tar.gz cpython-7303b594e62349251cbb9d98141a96885fc88e6f.tar.bz2 |
Merged revisions 70444 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70444 | mark.dickinson | 2009-03-18 08:22:51 +0000 (Wed, 18 Mar 2009) | 3 lines
Fix bug in _insert_thousands_sep: too much zero padding could be
added for 'n' formats with non-repeating thousands-separator.
........
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r-- | Lib/test/test_decimal.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index c02b813..219348c 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -798,6 +798,28 @@ class DecimalFormatTest(unittest.TestCase): self.assertEqual(get_fmt(123456789, ru_RU, '.6n'), '1,23457e+8') self.assertEqual(get_fmt(123456789, crazy, '.6n'), '1&23457e+8') + # zero padding + self.assertEqual(get_fmt(1234, fr_FR, '03n'), '1234') + self.assertEqual(get_fmt(1234, fr_FR, '04n'), '1234') + self.assertEqual(get_fmt(1234, fr_FR, '05n'), '01234') + self.assertEqual(get_fmt(1234, fr_FR, '06n'), '001234') + + self.assertEqual(get_fmt(12345, en_US, '05n'), '12,345') + self.assertEqual(get_fmt(12345, en_US, '06n'), '12,345') + self.assertEqual(get_fmt(12345, en_US, '07n'), '012,345') + self.assertEqual(get_fmt(12345, en_US, '08n'), '0,012,345') + self.assertEqual(get_fmt(12345, en_US, '09n'), '0,012,345') + self.assertEqual(get_fmt(12345, en_US, '010n'), '00,012,345') + + self.assertEqual(get_fmt(123456, crazy, '06n'), '1-2345-6') + self.assertEqual(get_fmt(123456, crazy, '07n'), '1-2345-6') + self.assertEqual(get_fmt(123456, crazy, '08n'), '1-2345-6') + self.assertEqual(get_fmt(123456, crazy, '09n'), '01-2345-6') + self.assertEqual(get_fmt(123456, crazy, '010n'), '0-01-2345-6') + self.assertEqual(get_fmt(123456, crazy, '011n'), '0-01-2345-6') + self.assertEqual(get_fmt(123456, crazy, '012n'), '00-01-2345-6') + self.assertEqual(get_fmt(123456, crazy, '013n'), '000-01-2345-6') + class DecimalArithmeticOperatorsTest(unittest.TestCase): '''Unit tests for all arithmetic operators, binary and unary.''' |