[pypy-svn] r28130 - in pypy/dist/pypy/rpython: ootypesystem test

antocuni at codespeak.net antocuni at codespeak.net
Sat Jun 3 10:28:14 CEST 2006


Author: antocuni
Date: Sat Jun  3 10:28:12 2006
New Revision: 28130

Modified:
   pypy/dist/pypy/rpython/ootypesystem/rstr.py
   pypy/dist/pypy/rpython/test/test_rfloat.py
Log:
(antocuni, nik)

Added a test and fixed a bug about string formatting with floats.



Modified: pypy/dist/pypy/rpython/ootypesystem/rstr.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/rstr.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/rstr.py	Sat Jun  3 10:28:12 2006
@@ -206,6 +206,7 @@
         return hop.genop('oosend', [c_build, v_buf], resulttype=ootype.String)        
     do_stringformat = classmethod(do_stringformat)
 
+
 def add_helpers():
     dic = {}
     for name, meth in ootype.String._GENERIC_METHODS.iteritems():
@@ -223,7 +224,7 @@
 add_helpers()
 del add_helpers
 
-
+do_stringformat = LLHelpers.do_stringformat
 string_repr = StringRepr()
 char_repr = CharRepr()
 unichar_repr = UniCharRepr()

Modified: pypy/dist/pypy/rpython/test/test_rfloat.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rfloat.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rfloat.py	Sat Jun  3 10:28:12 2006
@@ -58,6 +58,13 @@
         res = self.interpret(fn, [1.5])
         assert float(self.ll_to_string(res)) == 1.5
 
+    def test_string_mod_float(self):
+        def fn(f):
+            return '%f' % f
+
+        res = self.interpret(fn, [1.5])
+        assert float(self.ll_to_string(res)) == 1.5
+
 class TestLLtype(BaseTestRfloat, LLRtypeMixin):
     pass
 



More information about the Pypy-commit mailing list