Sha256: f068b1175b1f0ee0835a5d16799f5d12f3ef83a951d88bc799398b3ffe35179e

Contents?: true

Size: 1.23 KB

Versions: 30

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env python
import sys
from test_support import verbose
import string_tests
# UserString is a wrapper around the native builtin string type.
# UserString instances should behave similar to builtin string objects.
# The test cases were in part derived from 'test_string.py'.
from UserString import UserString

if __name__ == "__main__":
    verbose = '-v' in sys.argv

tested_methods = {}

def test(methodname, input, output, *args):
    global tested_methods
    tested_methods[methodname] = 1
    if verbose:
        print '%r.%s(%s)' % (input, methodname, ", ".join(map(repr, args))),
    u = UserString(input)
    objects = [input, u, UserString(u)]
    res = [""] * 3
    for i in range(3):
        object = objects[i]
        try:
            f = getattr(object, methodname)
        except AttributeError:
            f = None
            res[i] = AttributeError
        else:
            try:
                res[i] = apply(f, args)
            except:
                res[i] = sys.exc_type
    if res[0] == res[1] == res[2] == output:
        if verbose:
            print 'yes'
    else:
        if verbose:
            print 'no'
        print (methodname, input, output, args, res[0], res[1], res[2])

string_tests.run_method_tests(test)

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rubyfox-server-2.19.2.0 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.17.3.2 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.17.3.1 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.17.3.0 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.16.3.2 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.16.3.1 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.16.0.4 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.16.0.3 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.16.0.2 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.16.0.1 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.16.0.0 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.13.7.3 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.13.6.2 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.13.6.1 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.13.5.1 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.13.4.1 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.13.3.1 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.12.5.1 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.12.5.0 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py
rubyfox-server-2.12.4.0 lib/rubyfox/server/data/lib/Lib/test/test_userstring.py