[pypy-svn] r34515 - in pypy/dist/pypy/objspace/std: benchmark test

cfbolz at codespeak.net cfbolz at codespeak.net
Sat Nov 11 23:15:46 CET 2006


Author: cfbolz
Date: Sat Nov 11 23:15:44 2006
New Revision: 34515

Modified:
   pypy/dist/pypy/objspace/std/benchmark/bench_dict.py
   pypy/dist/pypy/objspace/std/test/test_rangeobject.py
   pypy/dist/pypy/objspace/std/test/test_strjoinobject.py
   pypy/dist/pypy/objspace/std/test/test_strsliceobject.py
Log:
pypy_repr moved to pypymagic


Modified: pypy/dist/pypy/objspace/std/benchmark/bench_dict.py
==============================================================================
--- pypy/dist/pypy/objspace/std/benchmark/bench_dict.py	(original)
+++ pypy/dist/pypy/objspace/std/benchmark/bench_dict.py	Sat Nov 11 23:15:44 2006
@@ -47,6 +47,6 @@
 
 if __name__ == '__main__':
     test_d = bench_simple_dict()
-    import sys
-    print sys.pypy_repr(test_d)
-    print sys.pypy_repr(test_d.iterkeys())
+    import pypymagic
+    print pypymagic.pypy_repr(test_d)
+    print pypymagic.pypy_repr(test_d.iterkeys())

Modified: pypy/dist/pypy/objspace/std/test/test_rangeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_rangeobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_rangeobject.py	Sat Nov 11 23:15:44 2006
@@ -7,10 +7,10 @@
     def setup_class(cls):
         cls.space = gettestobjspace(**{"objspace.std.withrangelist": True})
         cls.w_not_forced = cls.space.appexec([], """():
-            import sys
+            import pypymagic
             def f(r):
                 return (isinstance(r, list) and
-                        "W_ListObject" not in sys.pypy_repr(r))
+                        "W_ListObject" not in pypymagic.pypy_repr(r))
             return f
         """)
 

Modified: pypy/dist/pypy/objspace/std/test/test_strjoinobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_strjoinobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_strjoinobject.py	Sat Nov 11 23:15:44 2006
@@ -9,13 +9,13 @@
         cls.space = gettestobjspace(**{"objspace.std.withstrjoin": True})
 
     def test_basic(self):
-        import sys
+        import pypymagic
         s = "Hello, " + "World!"
         assert type(s) is str
-        assert 'W_StringJoinObject' in sys.pypy_repr(s)
+        assert 'W_StringJoinObject' in pypymagic.pypy_repr(s)
 
     def test_function_with_strjoin(self):
-        py.test.skip("Failing")
+        skip("Failing")
         def f(x, y):
             if x[-1] != "/":
                 x += "/"
@@ -48,7 +48,6 @@
         assert hash(s) & 0x7fffffff == 0x7e0bce58
 
     def test_len(self):
-        import sys
         s = "a" + "b"
         r = "c" + "d"
         t = s + r

Modified: pypy/dist/pypy/objspace/std/test/test_strsliceobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_strsliceobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_strsliceobject.py	Sat Nov 11 23:15:44 2006
@@ -9,22 +9,22 @@
         cls.space = gettestobjspace(**{"objspace.std.withstrslice": True})
 
     def test_basic(self):
-        import sys
+        import pypymagic
         def slice(s): return (s*3)[len(s):-len(s)]
         s = slice('0123456789' * 20)
         assert len(s) == 200
         assert s[5] == '5'
         assert s[-2] == '8'
         assert s[3:7] == '3456'
-        assert 'W_StringSliceObject' in sys.pypy_repr(s)
+        assert 'W_StringSliceObject' in pypymagic.pypy_repr(s)
         # when the slice is too short, don't use the slice string object
-        assert 'W_StringObject' in sys.pypy_repr("abcdefgh"[3:7])
+        assert 'W_StringObject' in pypymagic.pypy_repr("abcdefgh"[3:7])
 
     def test_find(self):
-        import sys
+        import pypymagic
         def slice(s): return (s*3)[len(s):-len(s)]
         s = slice('abcdefghiabc' + "X" * 100)
-        assert 'W_StringSliceObject' in sys.pypy_repr(s)
+        assert 'W_StringSliceObject' in pypymagic.pypy_repr(s)
         assert slice('abcdefghiabc' + 'X' * 100) == 'abcdefghiabc' + 'X' * 100
         res = s.find('abc')
         assert res == 0
@@ -32,11 +32,11 @@
         assert s.find('def', 4) == -1
 
     def test_index(self):
-        import sys
+        import pypymagic, sys
         m = sys.maxint
         def slice(s): return (s*3)[len(s):-len(s)]
         s = slice('abcdefghiabc' * 20)
-        assert 'W_StringSliceObject' in sys.pypy_repr(s)
+        assert 'W_StringSliceObject' in pypymagic.pypy_repr(s)
         assert s.index('') == 0
         assert s.index('def') == 3
         assert s.index('abc') == 0
@@ -50,21 +50,21 @@
         raises(TypeError, slice('abcdefghijklmn' * 20).index, 'abc', -10.0, 30)
 
     def test_rfind(self):
-        import sys
+        import pypymagic
         def slice(s): return (s*3)[len(s):-len(s)]
         s = slice('abcdefghiabc' + "X" * 100)
-        assert 'W_StringSliceObject' in sys.pypy_repr(s)
+        assert 'W_StringSliceObject' in pypymagic.pypy_repr(s)
         assert s.rfind('abc') == 9
         assert s.rfind('') == 112
         assert s.rfind('abcd') == 0
         assert s.rfind('abcz') == -1
 
     def test_rindex(self):
-        import sys
+        import pypymagic
         from sys import maxint
         def slice(s): return (s*3)[len(s):-len(s)]
         s = slice("X" * 100 + 'abcdefghiabc')
-        assert 'W_StringSliceObject' in sys.pypy_repr(s)
+        assert 'W_StringSliceObject' in pypymagic.pypy_repr(s)
         assert s.rindex('') == 112
         assert s.rindex('def') == 103
         assert s.rindex('abc') == 109
@@ -81,10 +81,10 @@
                'abc', -10.0, 30)
 
     def test_contains(self):
-        import sys
+        import pypymagic
         def slice(s): return (s*3)[len(s):-len(s)]
         s = slice("abc" + "X" * 100)
-        assert 'W_StringSliceObject' in sys.pypy_repr(s)
+        assert 'W_StringSliceObject' in pypymagic.pypy_repr(s)
         assert '' in s
         assert 'a' in s
         assert 'ab' in s
@@ -92,11 +92,11 @@
         raises(TypeError, slice('a' * 100).__contains__, 1)
         
     def test_hash(self):
-        import sys
+        import pypymagic
         # check that we have the same hash as CPython for at least 31 bits
         # (but don't go checking CPython's special case -1)
         # disabled: assert hash('') == 0 --- different special case
         def slice(s): return (s*3)[len(s):-len(s)]
         s = slice('a' * 101)
-        assert 'W_StringSliceObject' in sys.pypy_repr(s)
+        assert 'W_StringSliceObject' in pypymagic.pypy_repr(s)
         assert hash(s) & 0x7fffffff == 0x7e0bce58



More information about the Pypy-commit mailing list