示例#1
0
 def test_smalllong(self):
     import __pypy__
     x = -123456789012345L
     assert 'SmallLong' in __pypy__.internal_repr(x)
     y = self.marshal_check(x)
     assert y == x
     # must be unpickled as a small long
     assert 'SmallLong' in __pypy__.internal_repr(y)
 def test_smalllong(self):
     import __pypy__
     x = self._small(-123456789012345)
     assert 'SmallLong' in __pypy__.internal_repr(x)
     y = self.marshal_check(x)
     assert y == x
     # must be unpickled as a small long
     assert 'SmallLong' in __pypy__.internal_repr(y)
示例#3
0
 def test_sl_add_32(self):
     import sys, __pypy__
     if sys.maxint == 2147483647:
         x = 2147483647
         assert x + x == 4294967294L
         assert 'SmallLong' in __pypy__.internal_repr(x + x)
         y = -1
         assert x - y == 2147483648L
         assert 'SmallLong' in __pypy__.internal_repr(x - y)
示例#4
0
 def test_strlist_append(self):
     import __pypy__
     l = []
     l.append("a")
     assert "StrListImplementation" in __pypy__.internal_repr(l)
     l.extend(["b", "c", "d"])
     l += ["e", "f"]
     assert l == ["a", "b", "c", "d", "e", "f"]
     assert "StrListImplementation" in __pypy__.internal_repr(l)
示例#5
0
 def test_append_extend_dont_force(self):
     import __pypy__
     l = [i for i in range(100)] # force it to not be a range impl
     l2 = l[1:-1]
     assert "SliceTrackingListImplementation" in __pypy__.internal_repr(l)
     assert "SliceListImplementation" in __pypy__.internal_repr(l2)
     l.append(100)
     l.extend(range(101, 110))
     assert l == range(110)
     assert "SliceTrackingListImplementation" in __pypy__.internal_repr(l)
     assert "SliceListImplementation" in __pypy__.internal_repr(l2)
示例#6
0
 def test_errno(self):
     from socket import socket, AF_INET, SOCK_STREAM, error
     import errno
     try:
         s = socket(AF_INET, SOCK_STREAM)
         import __pypy__
         print __pypy__.internal_repr(s)
         s.accept()
     except Exception, e:
         assert len(e.args) == 2
         # error is EINVAL, or WSAEINVAL on Windows
         assert errno.errorcode[e.args[0]].endswith("EINVAL")
         assert isinstance(e.args[1], str)
示例#7
0
 def test_slice_of_slice(self):
     import __pypy__
     l = [i for i in range(100)] # force it to not be a range impl
     l2 = l[1:-1]
     l3 = l2[1:-1]
     l4 = l3[1:-1]
     assert l2 == range(1, 99)
     assert l3 == range(2, 98)
     assert l4 == range(3, 97)
     assert "SliceListImplementation" in __pypy__.internal_repr(l4)
     l2[3] = 4
     assert "SliceListImplementation" not in __pypy__.internal_repr(l2)
     assert "SliceListImplementation" in __pypy__.internal_repr(l4)
示例#8
0
 def test_errno(self):
     from socket import socket, AF_INET, SOCK_STREAM, error
     import errno
     try:
         s = socket(AF_INET, SOCK_STREAM)
         import __pypy__
         print __pypy__.internal_repr(s)
         s.accept()
     except Exception, e:
         assert len(e.args) == 2
         # error is EINVAL, or WSAEINVAL on Windows
         assert errno.errorcode[e.args[0]].endswith("EINVAL")
         assert isinstance(e.args[1], str)
示例#9
0
 def test_lazy_slice(self):
     import __pypy__
     l = [i for i in range(100)] # force it to not be a range impl
     l2 = l[1:-1]
     assert "SliceTrackingListImplementation" in __pypy__.internal_repr(l)
     assert "SliceListImplementation" in __pypy__.internal_repr(l2)
     result = 0
     for i in l2:
         result += i
     # didn't force l2
     assert "SliceListImplementation" in __pypy__.internal_repr(l2)
     # force l2:
     l2.append(10)
     assert l2 == range(1, 99) + [10]
示例#10
0
 def test_sl_add(self):
     import __pypy__
     x = 0x123456789ABCDEFL
     assert x + x == 0x2468ACF13579BDEL
     assert 'SmallLong' in __pypy__.internal_repr(x + x)
     x = -0x123456789ABCDEFL
     assert x + x == -0x2468ACF13579BDEL
     assert 'SmallLong' in __pypy__.internal_repr(x + x)
     x = 0x723456789ABCDEF0L
     assert x + x == 0xE468ACF13579BDE0L
     assert 'SmallLong' not in __pypy__.internal_repr(x + x)
     x = -0x723456789ABCDEF0L
     assert x + x == -0xE468ACF13579BDE0L
     assert 'SmallLong' not in __pypy__.internal_repr(x + x)
示例#11
0
 def test_basic(self):
     import __pypy__
     def slice(s): return (s*3)[len(s):-len(s)]
     s = slice('0123456789' * 20)
     assert len(s) == 200
     assert self.not_forced(s)
     assert s[5] == '5'
     assert s[-2] == '8'
     assert s[3:7] == '3456'
     assert 'W_StringSliceObject' in __pypy__.internal_repr(s)
     # when the slice is too short, don't use the slice string object
     assert 'W_StringObject' in __pypy__.internal_repr("abcdefgh"[3:7])
     s2 = s.upper()
     assert not self.not_forced(s)
示例#12
0
 def test_add(self):
     import __pypy__
     all = ""
     for i in range(20):
         all += str(i)
     assert 'W_StringBufferObject' in __pypy__.internal_repr(all)
     assert all == "012345678910111213141516171819"
示例#13
0
    def test_rindex(self):
        import __pypy__
        from sys import maxint

        def slice(s):
            return (s * 3)[len(s):-len(s)]

        s = slice("X" * 100 + 'abcdefghiabc')
        assert 'W_StringSliceObject' in __pypy__.internal_repr(s)
        assert s.rindex('') == 112
        assert s.rindex('def') == 103
        assert s.rindex('abc') == 109
        assert s.rindex('abc', 0, -1) == 100
        assert s.rindex('abc', -4 * maxint, 4 * maxint) == 109
        raises(ValueError, slice('abcdefghiabc' * 20).rindex, 'hib')
        raises(ValueError, slice('defghiabc' + "X" * 100).rindex, 'def', 1)
        raises(ValueError,
               slice('defghiabc' + "X" * 100).rindex, 'abc', 0, -101)
        raises(ValueError, slice('abcdefghi' + "X" * 100).rindex, 'ghi', 0, 8)
        raises(ValueError,
               slice('abcdefghi' + "X" * 100).rindex, 'ghi', 0, -101)
        raises(TypeError,
               slice('abcdefghijklmn' + "X" * 100).rindex, 'abc', 0, 0.0)
        raises(TypeError,
               slice('abcdefghijklmn' + "X" * 100).rindex, 'abc', -10.0, 30)
示例#14
0
 def test_hash(self):
     import __pypy__
     def join(s): return s[:len(s) // 2] + s[len(s) // 2:]
     t = 'a' * 101
     s = join(t)
     assert 'W_StringBufferObject' in __pypy__.internal_repr(s)
     assert hash(s) == hash(t)
示例#15
0
 def test_basic(self):
     import __pypy__
     # cannot do "Hello, " + "World!" because cpy2.5 optimises this
     # away on AST level (no idea why it doesn't this one)
     s = "Hello, ".__add__("World!")
     assert type(s) is str
     assert 'W_StringJoinObject' in __pypy__.internal_repr(s)
示例#16
0
 def test_basic(self):
     import __pypy__
     # cannot do "Hello, " + "World!" because cpy2.5 optimises this
     # away on AST level
     s = "Hello, ".__add__("World!")
     assert type(s) is str
     assert 'W_StringBufferObject' in __pypy__.internal_repr(s)
示例#17
0
 def test_add(self):
     import __pypy__
     all = ""
     for i in range(20):
         all += str(i)
     assert 'W_StringBufferObject' in __pypy__.internal_repr(all)
     assert all == "012345678910111213141516171819"
示例#18
0
 def test_basic(self):
     import __pypy__
     # cannot do "Hello, " + "World!" because cpy2.5 optimises this
     # away on AST level
     s = "Hello, ".__add__("World!")
     assert type(s) is str
     assert 'W_StringBufferObject' in __pypy__.internal_repr(s)
示例#19
0
    def test_basic(self):
        import __pypy__

        def slice(s):
            return (s * 3)[len(s):-len(s)]

        s = slice('0123456789' * 20)
        assert len(s) == 200
        assert self.not_forced(s)
        assert s[5] == '5'
        assert s[-2] == '8'
        assert s[3:7] == '3456'
        assert 'W_StringSliceObject' in __pypy__.internal_repr(s)
        # when the slice is too short, don't use the slice string object
        assert 'W_StringObject' in __pypy__.internal_repr("abcdefgh"[3:7])
        s2 = s.upper()
        assert not self.not_forced(s)
示例#20
0
 def test_hash(self):
     import __pypy__
     # 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 join(s): return s[:len(s) // 2] + s[len(s) // 2:]
     s = join('a' * 101)
     assert 'W_StringJoinObject' in __pypy__.internal_repr(s)
     assert hash(s) & 0x7fffffff == 0x7e0bce58
示例#21
0
 def test_hash(self):
     import __pypy__
     # 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 __pypy__.internal_repr(s)
     assert hash(s) & 0x7fffffff == 0x7e0bce58
示例#22
0
 def test_rfind(self):
     import __pypy__
     def slice(s): return (s*3)[len(s):-len(s)]
     s = slice('abcdefghiabc' + "X" * 100)
     assert 'W_StringSliceObject' in __pypy__.internal_repr(s)
     assert s.rfind('abc') == 9
     assert s.rfind('') == 112
     assert s.rfind('abcd') == 0
     assert s.rfind('abcz') == -1
示例#23
0
    def test_popitem(self):
        import __pypy__

        d = self.d
        assert "ModuleDict" in __pypy__.internal_repr(d)
        raises(KeyError, d.popitem)
        d["a"] = 3
        x = d.popitem()
        assert x == ("a", 3)
示例#24
0
    def test_popitem(self):
        import __pypy__

        d = self.d
        assert "ModuleDict" in __pypy__.internal_repr(d)
        raises(KeyError, d.popitem)
        d["a"] = 3
        x = d.popitem()
        assert x == ("a", 3)
示例#25
0
    def test_degenerate(self):
        import __pypy__

        d = self.d
        assert "ModuleDict" in __pypy__.internal_repr(d)
        d["a"] = 3
        del d["a"]
        d[object()] = 5
        assert d.values() == [5]
示例#26
0
    def test_degenerate(self):
        import __pypy__

        d = self.d
        assert "ModuleDict" in __pypy__.internal_repr(d)
        d["a"] = 3
        del d["a"]
        d[object()] = 5
        assert d.values() == [5]
示例#27
0
    def test_unicode(self):
        import __pypy__

        d = self.d
        assert "ModuleDict" in __pypy__.internal_repr(d)
        d['λ'] = True
        assert "ModuleDict" in __pypy__.internal_repr(d)
        assert list(d) == ['λ']
        assert next(iter(d)) == 'λ'
        assert "ModuleDict" in __pypy__.internal_repr(d)

        d['foo'] = 'bar'
        assert sorted(d) == ['foo', 'λ']
        assert "ModuleDict" in __pypy__.internal_repr(d)

        o = object()
        d[o] = 'baz'
        assert set(d) == set(['foo', 'λ', o])
        assert "ObjectDictStrategy" in __pypy__.internal_repr(d)
示例#28
0
 def test_find(self):
     import __pypy__
     def slice(s): return (s*3)[len(s):-len(s)]
     s = slice('abcdefghiabc' + "X" * 100)
     assert 'W_StringSliceObject' in __pypy__.internal_repr(s)
     assert slice('abcdefghiabc' + 'X' * 100) == 'abcdefghiabc' + 'X' * 100
     res = s.find('abc')
     assert res == 0
     assert s.find('abc', 1) == 9
     assert s.find('def', 4) == -1
示例#29
0
    def test_unicode(self):
        import __pypy__

        d = self.d
        assert "ModuleDict" in __pypy__.internal_repr(d)
        d['λ'] = True
        assert "ModuleDict" in __pypy__.internal_repr(d)
        assert list(d) == ['λ']
        assert next(iter(d)) == 'λ'
        assert "ModuleDict" in __pypy__.internal_repr(d)

        d['foo'] = 'bar'
        assert sorted(d) == ['foo', 'λ']
        assert "ModuleDict" in __pypy__.internal_repr(d)

        o = object()
        d[o] = 'baz'
        assert set(d) == set(['foo', 'λ', o])
        assert "ObjectDictStrategy" in __pypy__.internal_repr(d)
示例#30
0
 def test_contains(self):
     import __pypy__
     def slice(s): return (s*3)[len(s):-len(s)]
     s = slice("abc" + "X" * 100)
     assert 'W_StringSliceObject' in __pypy__.internal_repr(s)
     assert '' in s
     assert 'a' in s
     assert 'ab' in s
     assert not 'd' in s
     raises(TypeError, slice('a' * 100).__contains__, 1)
示例#31
0
    def test_hash(self):
        import __pypy__

        def join(s):
            return s[:len(s) // 2] + s[len(s) // 2:]

        t = 'a' * 101
        s = join(t)
        assert 'W_StringBufferObject' in __pypy__.internal_repr(s)
        assert hash(s) == hash(t)
示例#32
0
 def test_sl_hash(self):
     import __pypy__
     x = 5L
     assert 'SmallLong' in __pypy__.internal_repr(x)
     assert hash(5) == hash(x)
     biglong = 5L
     biglong ^= 2**100      # hack based on the fact that xor__Long_Long
     biglong ^= 2**100      # does not call newlong()
     assert biglong == 5L
     assert 'SmallLong' not in __pypy__.internal_repr(biglong)
     assert hash(5) == hash(biglong)
     #
     x = 0x123456789ABCDEFL
     assert 'SmallLong' in __pypy__.internal_repr(x)
     biglong = x
     biglong ^= 2**100
     biglong ^= 2**100
     assert biglong == x
     assert 'SmallLong' not in __pypy__.internal_repr(biglong)
     assert hash(biglong) == hash(x)
示例#33
0
    def test_rfind(self):
        import __pypy__

        def slice(s):
            return (s * 3)[len(s):-len(s)]

        s = slice('abcdefghiabc' + "X" * 100)
        assert 'W_StringSliceObject' in __pypy__.internal_repr(s)
        assert s.rfind('abc') == 9
        assert s.rfind('') == 112
        assert s.rfind('abcd') == 0
        assert s.rfind('abcz') == -1
示例#34
0
    def test_rfind(self):
        import __pypy__

        def slice(s):
            return (s * 3)[len(s) : -len(s)]

        s = slice("abcdefghiabc" + "X" * 100)
        assert "W_StringSliceObject" in __pypy__.internal_repr(s)
        assert s.rfind("abc") == 9
        assert s.rfind("") == 112
        assert s.rfind("abcd") == 0
        assert s.rfind("abcz") == -1
示例#35
0
    def test_contains(self):
        import __pypy__

        def slice(s):
            return (s * 3)[len(s) : -len(s)]

        s = slice("abc" + "X" * 100)
        assert "W_StringSliceObject" in __pypy__.internal_repr(s)
        assert "" in s
        assert "a" in s
        assert "ab" in s
        assert not "d" in s
        raises(TypeError, slice("a" * 100).__contains__, 1)
示例#36
0
    def test_contains(self):
        import __pypy__

        def slice(s):
            return (s * 3)[len(s):-len(s)]

        s = slice("abc" + "X" * 100)
        assert 'W_StringSliceObject' in __pypy__.internal_repr(s)
        assert '' in s
        assert 'a' in s
        assert 'ab' in s
        assert not 'd' in s
        raises(TypeError, slice('a' * 100).__contains__, 1)
示例#37
0
    def test_find(self):
        import __pypy__

        def slice(s):
            return (s * 3)[len(s) : -len(s)]

        s = slice("abcdefghiabc" + "X" * 100)
        assert "W_StringSliceObject" in __pypy__.internal_repr(s)
        assert slice("abcdefghiabc" + "X" * 100) == "abcdefghiabc" + "X" * 100
        res = s.find("abc")
        assert res == 0
        assert s.find("abc", 1) == 9
        assert s.find("def", 4) == -1
示例#38
0
    def test_find(self):
        import __pypy__

        def slice(s):
            return (s * 3)[len(s):-len(s)]

        s = slice('abcdefghiabc' + "X" * 100)
        assert 'W_StringSliceObject' in __pypy__.internal_repr(s)
        assert slice('abcdefghiabc' + 'X' * 100) == 'abcdefghiabc' + 'X' * 100
        res = s.find('abc')
        assert res == 0
        assert s.find('abc', 1) == 9
        assert s.find('def', 4) == -1
示例#39
0
 def test_index(self):
     import __pypy__, sys
     m = sys.maxint
     def slice(s): return (s*3)[len(s):-len(s)]
     s = slice('abcdefghiabc' * 20)
     assert 'W_StringSliceObject' in __pypy__.internal_repr(s)
     assert s.index('') == 0
     assert s.index('def') == 3
     assert s.index('abc') == 0
     assert s.index('abc', 1) == 9
     assert s.index('def', -4*m, 4*m) == 3
     raises(ValueError, s.index, 'hib')
     raises(ValueError, slice('abcdefghiab' + "X" * 100).index, 'abc', 1)
     raises(ValueError, slice('abcdefghi'  + "X" * 20).index, 'ghi', 8)
     raises(ValueError, slice('abcdefghi' + "X" * 20).index, 'ghi', -1)
     raises(TypeError, slice('abcdefghijklmn' * 20).index, 'abc', 0, 0.0)
     raises(TypeError, slice('abcdefghijklmn' * 20).index, 'abc', -10.0, 30)
示例#40
0
    def test_index(self):
        import __pypy__, sys
        m = sys.maxint

        def slice(s):
            return (s * 3)[len(s):-len(s)]

        s = slice('abcdefghiabc' * 20)
        assert 'W_StringSliceObject' in __pypy__.internal_repr(s)
        assert s.index('') == 0
        assert s.index('def') == 3
        assert s.index('abc') == 0
        assert s.index('abc', 1) == 9
        assert s.index('def', -4 * m, 4 * m) == 3
        raises(ValueError, s.index, 'hib')
        raises(ValueError, slice('abcdefghiab' + "X" * 100).index, 'abc', 1)
        raises(ValueError, slice('abcdefghi' + "X" * 20).index, 'ghi', 8)
        raises(ValueError, slice('abcdefghi' + "X" * 20).index, 'ghi', -1)
        raises(TypeError, slice('abcdefghijklmn' * 20).index, 'abc', 0, 0.0)
        raises(TypeError, slice('abcdefghijklmn' * 20).index, 'abc', -10.0, 30)
示例#41
0
 def test_rindex(self):
     import __pypy__
     from sys import maxint
     def slice(s): return (s*3)[len(s):-len(s)]
     s = slice("X" * 100 + 'abcdefghiabc')
     assert 'W_StringSliceObject' in __pypy__.internal_repr(s)
     assert s.rindex('') == 112
     assert s.rindex('def') == 103
     assert s.rindex('abc') == 109
     assert s.rindex('abc', 0, -1) == 100
     assert s.rindex('abc', -4*maxint, 4*maxint) == 109
     raises(ValueError, slice('abcdefghiabc' * 20).rindex, 'hib')
     raises(ValueError, slice('defghiabc' + "X" * 100).rindex, 'def', 1)
     raises(ValueError, slice('defghiabc' + "X" * 100).rindex, 'abc', 0, -101)
     raises(ValueError, slice('abcdefghi' + "X" * 100).rindex, 'ghi', 0, 8)
     raises(ValueError, slice('abcdefghi' + "X" * 100).rindex, 'ghi', 0, -101)
     raises(TypeError, slice('abcdefghijklmn' + "X" * 100).rindex,
            'abc', 0, 0.0)
     raises(TypeError, slice('abcdefghijklmn' + "X" * 100).rindex,
            'abc', -10.0, 30)
示例#42
0
    def test_rindex(self):
        import __pypy__
        from sys import maxint

        def slice(s):
            return (s * 3)[len(s) : -len(s)]

        s = slice("X" * 100 + "abcdefghiabc")
        assert "W_StringSliceObject" in __pypy__.internal_repr(s)
        assert s.rindex("") == 112
        assert s.rindex("def") == 103
        assert s.rindex("abc") == 109
        assert s.rindex("abc", 0, -1) == 100
        assert s.rindex("abc", -4 * maxint, 4 * maxint) == 109
        raises(ValueError, slice("abcdefghiabc" * 20).rindex, "hib")
        raises(ValueError, slice("defghiabc" + "X" * 100).rindex, "def", 1)
        raises(ValueError, slice("defghiabc" + "X" * 100).rindex, "abc", 0, -101)
        raises(ValueError, slice("abcdefghi" + "X" * 100).rindex, "ghi", 0, 8)
        raises(ValueError, slice("abcdefghi" + "X" * 100).rindex, "ghi", 0, -101)
        raises(TypeError, slice("abcdefghijklmn" + "X" * 100).rindex, "abc", 0, 0.0)
        raises(TypeError, slice("abcdefghijklmn" + "X" * 100).rindex, "abc", -10.0, 30)
示例#43
0
    def test_index(self):
        import __pypy__, sys

        m = sys.maxint

        def slice(s):
            return (s * 3)[len(s) : -len(s)]

        s = slice("abcdefghiabc" * 20)
        assert "W_StringSliceObject" in __pypy__.internal_repr(s)
        assert s.index("") == 0
        assert s.index("def") == 3
        assert s.index("abc") == 0
        assert s.index("abc", 1) == 9
        assert s.index("def", -4 * m, 4 * m) == 3
        raises(ValueError, s.index, "hib")
        raises(ValueError, slice("abcdefghiab" + "X" * 100).index, "abc", 1)
        raises(ValueError, slice("abcdefghi" + "X" * 20).index, "ghi", 8)
        raises(ValueError, slice("abcdefghi" + "X" * 20).index, "ghi", -1)
        raises(TypeError, slice("abcdefghijklmn" * 20).index, "abc", 0, 0.0)
        raises(TypeError, slice("abcdefghijklmn" * 20).index, "abc", -10.0, 30)
示例#44
0
 def test_sl_simple(self):
     import __pypy__
     s = __pypy__.internal_repr(self._long(5))
     assert 'SmallLong' in s
示例#45
0
 def w_get_strategy(self, obj):
     import __pypy__
     r = __pypy__.internal_repr(obj)
     return r[r.find("(") + 1: r.find(")")]
示例#46
0
    print name, " takes: %f" % (tk - t0)
    return retval


def bench_simple_dict(SIZE=10000):
    keys = [get_random_string(20) for i in xrange(SIZE)]
    values = [random.random() for i in xrange(SIZE)]

    lookup_keys = random.sample(keys, 1000)
    random_keys = [get_random_string(20) for i in xrange(1000)]

    test_d = count_operation("Creation", lambda: dict(zip(keys, values)))

    def rand_keys(keys):
        for key in keys:
            try:
                test_d[key]
            except KeyError:
                pass

    count_operation("Random key access", lambda: rand_keys(random_keys))
    count_operation("Existing key access", lambda: rand_keys(lookup_keys))
    return test_d


if __name__ == '__main__':
    test_d = bench_simple_dict()
    import __pypy__
    print __pypy__.internal_repr(test_d)
    print __pypy__.internal_repr(test_d.iterkeys())
示例#47
0
 def test_add(self):
     import __pypy__
     all = ""
     for i in range(20):
         all += str(i)
     assert 'W_StringJoinObject' in __pypy__.internal_repr(all)
示例#48
0
 def test_splitlines_produces_strslices(self):
     import __pypy__
     l = ("X" * 100 + "\n" + "Y" * 100).splitlines()
     assert "W_StringSliceObject" in __pypy__.internal_repr(l[0])
     assert "W_StringSliceObject" in __pypy__.internal_repr(l[1])
示例#49
0
 def w_uses_strategy(self, s, obj):
     import __pypy__
     return s in __pypy__.internal_repr(obj)
示例#50
0
 def w_isspecialised(self, obj, expected=''):
     import __pypy__
     r = __pypy__.internal_repr(obj)
     print obj, '==>', r, '   (expected: %r)' % expected
     return ("SpecialisedTupleObject" + expected) in r
示例#51
0
 def w_impl_used(self, obj):
     if self.runappdirect:
         skip("__repr__ doesn't work on appdirect")
     import __pypy__
     assert "ModuleDictStrategy" in __pypy__.internal_repr(obj)
示例#52
0
 def w_get_strategy(self, obj):
     import __pypy__
     r = __pypy__.internal_repr(obj)
     return r[r.find("(") + 1:r.find(")")]
 def w_isspecialised(self, obj, expected=''):
     import __pypy__
     r = __pypy__.internal_repr(obj)
     print obj, '==>', r, '   (expected: %r)' % expected
     return ("SpecialisedTupleObject" + expected) in r
示例#54
0
 def test_strip_produces_strslices(self):
     import __pypy__
     s = ("abc" + "X" * 100 + "," + "Y" * 100 + "abc").strip("abc")
     assert "W_StringSliceObject" in __pypy__.internal_repr(s)
示例#55
0
 def w_uses_identity_strategy(self, obj):
     import __pypy__
     return "IdentityDictStrategy" in __pypy__.internal_repr(obj)
示例#56
0
 def test_sl_long(self):
     import __pypy__
     x = long(0)
     assert 'SmallLong' in __pypy__.internal_repr(x)