Merged revisions 78349 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78349 | eric.smith | 2010-02-22 19:11:16 -0500 (Mon, 22 Feb 2010) | 1 line

  Issue #6902: Fix problem with built-in types format incorrectly with 0 padding.
........
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 8edf9d3..d58c073 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -357,6 +357,17 @@
                 self.assertEqual(value.__format__(format_spec),
                                  float(value).__format__(format_spec))
 
+        # Issue 6902
+        test(123456, "0<20", '12345600000000000000')
+        test(123456, "1<20", '12345611111111111111')
+        test(123456, "*<20", '123456**************')
+        test(123456, "0>20", '00000000000000123456')
+        test(123456, "1>20", '11111111111111123456')
+        test(123456, "*>20", '**************123456')
+        test(123456, "0=20", '00000000000000123456')
+        test(123456, "1=20", '11111111111111123456')
+        test(123456, "*=20", '**************123456')
+
     @run_with_locale('LC_NUMERIC', 'en_US.UTF8')
     def test_float__format__locale(self):
         # test locale support for __format__ code 'n'
@@ -510,6 +521,17 @@
         self.assertRaises(ValueError, format, 0.0, '#')
         self.assertRaises(ValueError, format, 0.0, '#20f')
 
+        # Issue 6902
+        test(12345.6, "0<20", '12345.60000000000000')
+        test(12345.6, "1<20", '12345.61111111111111')
+        test(12345.6, "*<20", '12345.6*************')
+        test(12345.6, "0>20", '000000000000012345.6')
+        test(12345.6, "1>20", '111111111111112345.6')
+        test(12345.6, "*>20", '*************12345.6')
+        test(12345.6, "0=20", '000000000000012345.6')
+        test(12345.6, "1=20", '111111111111112345.6')
+        test(12345.6, "*=20", '*************12345.6')
+
     def test_format_spec_errors(self):
         # int, float, and string all share the same format spec
         # mini-language parser.