Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_types.py @ 47973:3fa44e5e4e2b legacy-trunk
Complete issue 3083: add alternate (#) formatting to bin, oct, hex in str.format().
| author | Eric Smith <eric@trueblade.com> |
|---|---|
| date | Wed, 16 Jul 2008 00:11:49 +0000 |
| parents | c2b114d0e1cf |
| children | f283e3b5f917 |
line wrap: on
line diff
--- a/Lib/test/test_types.py Wed Jul 16 00:00:04 2008 +0000 +++ b/Lib/test/test_types.py Wed Jul 16 00:11:49 2008 +0000 @@ -365,7 +365,8 @@ 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') @@ -374,6 +375,8 @@ 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') @@ -382,6 +385,10 @@ 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') @@ -390,6 +397,10 @@ 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
