summaryrefslogtreecommitdiffstats
path: root/Lib/test/string_tests.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-02-24 13:08:18 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-02-24 13:08:18 (GMT)
commita612dc02ced728f553dcc91ca557a2a8b7fa0ca6 (patch)
tree62b717da0813ba63b61537d380ea923a1e657b3d /Lib/test/string_tests.py
parent8e21a3cf059aa8195716f6e7d3bfd0602daca6f1 (diff)
downloadcpython-a612dc02ced728f553dcc91ca557a2a8b7fa0ca6.zip
cpython-a612dc02ced728f553dcc91ca557a2a8b7fa0ca6.tar.gz
cpython-a612dc02ced728f553dcc91ca557a2a8b7fa0ca6.tar.bz2
Merged revisions 61034-61036,61038-61048 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r61034 | georg.brandl | 2008-02-24 01:03:22 +0100 (Sun, 24 Feb 2008) | 4 lines #900744: If an invalid chunked-encoding header is sent by a server, httplib will now raise IncompleteRead and close the connection instead of raising ValueError. ........ r61035 | georg.brandl | 2008-02-24 01:14:24 +0100 (Sun, 24 Feb 2008) | 2 lines #1627: httplib now ignores negative Content-Length headers. ........ r61039 | andrew.kuchling | 2008-02-24 03:39:15 +0100 (Sun, 24 Feb 2008) | 1 line Remove stray word ........ r61040 | neal.norwitz | 2008-02-24 03:40:58 +0100 (Sun, 24 Feb 2008) | 3 lines Add a little info to the 3k deprecation warnings about what to use instead. Suggested by Raymond Hettinger. ........ r61041 | facundo.batista | 2008-02-24 04:17:21 +0100 (Sun, 24 Feb 2008) | 4 lines Issue 1742669. Now %d accepts very big float numbers. Thanks Gabriel Genellina. ........ r61046 | neal.norwitz | 2008-02-24 08:21:56 +0100 (Sun, 24 Feb 2008) | 5 lines Get ctypes working on the Alpha (Tru64). The problem was that there were two module_methods and the one used depended on the order the modules were loaded. By making the test module_methods static, it is not exported and the correct version is picked up. ........ r61048 | neal.norwitz | 2008-02-24 09:27:49 +0100 (Sun, 24 Feb 2008) | 1 line Fix typo of hexidecimal ........
Diffstat (limited to 'Lib/test/string_tests.py')
-rw-r--r--Lib/test/string_tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index 24fca59..caafb31 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -1053,7 +1053,13 @@ class MixinStrUnicodeUserStringTest:
# unicode raises ValueError, str raises OverflowError
self.checkraises((ValueError, OverflowError), '%c', '__mod__', ordinal)
+ longvalue = sys.maxsize + 10
+ slongvalue = str(longvalue)
+ if slongvalue[-1] in ("L","l"): slongvalue = slongvalue[:-1]
self.checkequal(' 42', '%3ld', '__mod__', 42)
+ self.checkequal('42', '%d', '__mod__', 42.0)
+ self.checkequal(slongvalue, '%d', '__mod__', longvalue)
+ self.checkcall('%d', '__mod__', float(longvalue))
self.checkequal('0042.00', '%07.2f', '__mod__', 42)
self.checkequal('0042.00', '%07.2F', '__mod__', 42)
@@ -1063,6 +1069,8 @@ class MixinStrUnicodeUserStringTest:
self.checkraises(TypeError, '%c', '__mod__', (None,))
self.checkraises(ValueError, '%(foo', '__mod__', {})
self.checkraises(TypeError, '%(foo)s %(bar)s', '__mod__', ('foo', 42))
+ self.checkraises(TypeError, '%d', '__mod__', "42") # not numeric
+ self.checkraises(TypeError, '%d', '__mod__', (42+0j)) # no int/long conversion provided
# argument names with properly nested brackets are supported
self.checkequal('bar', '%((foo))s', '__mod__', {'(foo)': 'bar'})