2 # UserString is a wrapper around the native builtin string type.
3 # UserString instances should behave similar to builtin string objects.
6 from test
import test_support
, string_tests
8 from UserString
import UserString
11 string_tests
.CommonTest
,
12 string_tests
.MixinStrUnicodeUserStringTest
,
13 string_tests
.MixinStrStringUserStringTest
,
14 string_tests
.MixinStrUserStringTest
17 type2test
= UserString
19 # Overwrite the three testing methods, because UserString
20 # can't cope with arguments propagated to UserString
21 # (and we don't test with subclasses)
22 def checkequal(self
, result
, object, methodname
, *args
):
23 result
= self
.fixtype(result
)
24 object = self
.fixtype(object)
25 # we don't fix the arguments, because UserString can't cope with it
26 realresult
= getattr(object, methodname
)(*args
)
32 def checkraises(self
, exc
, object, methodname
, *args
):
33 object = self
.fixtype(object)
34 # we don't fix the arguments, because UserString can't cope with it
37 getattr(object, methodname
),
41 def checkcall(self
, object, methodname
, *args
):
42 object = self
.fixtype(object)
43 # we don't fix the arguments, because UserString can't cope with it
44 getattr(object, methodname
)(*args
)
47 suite
= unittest
.TestSuite()
48 suite
.addTest(unittest
.makeSuite(UserStringTest
))
49 test_support
.run_suite(suite
)
51 if __name__
== "__main__":