Merged revisions 64984 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r64984 | eric.smith | 2008-07-15 20:11:49 -0400 (Tue, 15 Jul 2008) | 1 line

  Complete issue 3083: add alternate (#) formatting to bin, oct, hex in str.format().
........
This commit is contained in:
Eric Smith 2008-07-16 00:15:35 +00:00
parent f70e195927
commit d68af8f743
4 changed files with 89 additions and 33 deletions

View file

@ -301,7 +301,8 @@ class TypesTests(unittest.TestCase):
test(-1, "-#5b", ' -0b1')
test(1, "+#5b", ' +0b1')
test(100, "+#b", '+0b1100100')
# test(100, "#012b", '0b001100100')
test(100, "#012b", '0b0001100100')
test(-100, "#012b", '-0b001100100')
test(0, "#o", '0o0')
test(0, "-#o", '0o0')
@ -310,6 +311,8 @@ class TypesTests(unittest.TestCase):
test(-1, "-#5o", ' -0o1')
test(1, "+#5o", ' +0o1')
test(100, "+#o", '+0o144')
test(100, "#012o", '0o0000000144')
test(-100, "#012o", '-0o000000144')
test(0, "#x", '0x0')
test(0, "-#x", '0x0')
@ -318,6 +321,10 @@ class TypesTests(unittest.TestCase):
test(-1, "-#5x", ' -0x1')
test(1, "+#5x", ' +0x1')
test(100, "+#x", '+0x64')
test(100, "#012x", '0x0000000064')
test(-100, "#012x", '-0x000000064')
test(123456, "#012x", '0x000001e240')
test(-123456, "#012x", '-0x00001e240')
test(0, "#X", '0X0')
test(0, "-#X", '0X0')
@ -326,6 +333,10 @@ class TypesTests(unittest.TestCase):
test(-1, "-#5X", ' -0X1')
test(1, "+#5X", ' +0X1')
test(100, "+#X", '+0X64')
test(100, "#012X", '0X0000000064')
test(-100, "#012X", '-0X000000064')
test(123456, "#012X", '0X000001E240')
test(-123456, "#012X", '-0X00001E240')
# make sure these are errors