3 from test_support
import verbose
5 # UserString is a wrapper around the native builtin string type.
6 # UserString instances should behave similar to builtin string objects.
7 # The test cases were in part derived from 'test_string.py'.
8 from UserString
import UserString
10 if __name__
== "__main__":
11 verbose
= '-v' in sys
.argv
15 def test(methodname
, input, output
, *args
):
17 tested_methods
[methodname
] = 1
19 print '%r.%s(%s)' % (input, methodname
, ", ".join(map(repr, args
))),
21 objects
= [input, u
, UserString(u
)]
26 f
= getattr(object, methodname
)
27 except AttributeError:
29 res
[i
] = AttributeError
32 res
[i
] = apply(f
, args
)
35 if res
[0] == res
[1] == res
[2] == output
:
41 print (methodname
, input, output
, args
, res
[0], res
[1], res
[2])
43 string_tests
.run_method_tests(test
)