summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_format.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-04-12 18:38:48 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-04-12 18:38:48 (GMT)
commitfff53250789c3879e5f63d4dde80d17e0b9c4dbb (patch)
tree2791ebaed57170dda86086e73280c1f9564959ce /Lib/test/test_format.py
parentbfb0cf822bedb25c38fa7f411af83d6654872dd4 (diff)
downloadcpython-fff53250789c3879e5f63d4dde80d17e0b9c4dbb.zip
cpython-fff53250789c3879e5f63d4dde80d17e0b9c4dbb.tar.gz
cpython-fff53250789c3879e5f63d4dde80d17e0b9c4dbb.tar.bz2
Bug 415514 reported that e.g.
"%#x" % 0 blew up, at heart because C sprintf supplies a base marker if and only if the value is not 0. I then fixed that, by tolerating C's inconsistency when it does %#x, and taking away that *Python* produced 0x0 when formatting 0L (the "long" flavor of 0) under %#x itself. But after talking with Guido, we agreed it would be better to supply 0x for the short int case too, despite that it's inconsistent with C, because C is inconsistent with itself and with Python's hex(0) (plus, while "%#x" % 0 didn't work before, "%#x" % 0L *did*, and returned "0x0"). Similarly for %#X conversion.
Diffstat (limited to 'Lib/test/test_format.py')
-rw-r--r--Lib/test/test_format.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index ce5d5f2..c74db0f 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -176,10 +176,10 @@ testboth("%o", 0, "0")
testboth("%o", 0L, "0")
testboth("%d", 0, "0")
testboth("%d", 0L, "0")
-testboth("%#x", 0, "0")
-testboth("%#x", 0L, "0")
-testboth("%#X", 0, "0")
-testboth("%#X", 0L, "0")
+testboth("%#x", 0, "0x0")
+testboth("%#x", 0L, "0x0")
+testboth("%#X", 0, "0X0")
+testboth("%#X", 0L, "0X0")
testboth("%x", 0x42, "42")
# testboth("%x", -0x42, "ffffffbe") # Alas, that's specific to 32-bit machines