[pypy-svn] r4815 - in pypy/trunk/src/pypy/objspace/std: . test
alex at codespeak.net
alex at codespeak.net
Tue Jun 1 17:55:33 CEST 2004
Author: alex
Date: Tue Jun 1 17:55:32 2004
New Revision: 4815
Modified:
pypy/trunk/src/pypy/objspace/std/stringobject.py
pypy/trunk/src/pypy/objspace/std/test/test_stringformat.py
Log:
more minor fixes of stuff that had dropped by the wayside due to some
incorrect conflict resolution &c
Modified: pypy/trunk/src/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/stringobject.py (original)
+++ pypy/trunk/src/pypy/objspace/std/stringobject.py Tue Jun 1 17:55:32 2004
@@ -976,7 +976,10 @@
raise TypeError, "format string mismatch"
elif index == 0 and not isinstance(values, tuple):
values = tuple([values])
- value = values[index]
+ try:
+ value = values[index]
+ except IndexError:
+ raise TypeError, "not enough arguments for format string"
if c=='s':
pieces.append(str(value))
Modified: pypy/trunk/src/pypy/objspace/std/test/test_stringformat.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/test/test_stringformat.py (original)
+++ pypy/trunk/src/pypy/objspace/std/test/test_stringformat.py Tue Jun 1 17:55:32 2004
@@ -57,24 +57,6 @@
def test_format_wrongchar(self):
self.assertRaises(ValueError, 'a%Zb'.__mod__, ((23,),))
-class TestStringObject(testit.AppTestCase):
-
- def setUp(self):
- self.space = testit.objspace('std')
-
- def test_format_item(self):
- self.assertEquals('a23b', 'a%sb' % 23)
- self.assertEquals('23b', '%sb' % 23)
- self.assertEquals('a23', 'a%s' % 23)
- self.assertEquals('23', '%s' % 23)
- self.assertEquals('a%b', 'a%%b' % ())
- self.assertEquals('%b', '%%b' % ())
- self.assertEquals('a%', 'a%%' % ())
- self.assertEquals('%', '%%' % ())
-
- def test_format_wrongchar(self):
- self.assertRaises(ValueError, 'a%Zb'.__mod__, ((23,),))
-
if __name__ == '__main__':
testit.main()
More information about the Pypy-commit
mailing list