MCPcopy Index your code
hub / github.com/python/cpython / checkequalnofix

Method checkequalnofix

Lib/test/test_str.py:84–100  ·  view source on GitHub ↗
(self, result, object, methodname, *args)

Source from the content-addressed store, hash-verified

82 self.addCleanup(codecs.unregister, search_function)
83
84 def checkequalnofix(self, result, object, methodname, *args):
85 method = getattr(object, methodname)
86 realresult = method(*args)
87 self.assertEqual(realresult, result)
88 self.assertTrue(type(realresult) is type(result))
89
90 # if the original is returned make sure that
91 # this doesn't happen with subclasses
92 if realresult is object:
93 class usub(str):
94 def __repr__(self):
95 return 'usub(%r)' % str.__repr__(self)
96 object = usub(object)
97 method = getattr(object, methodname)
98 realresult = method(*args)
99 self.assertEqual(realresult, result)
100 self.assertTrue(object is not realresult)
101
102 def assertTypedEqual(self, actual, expected):
103 self.assertIs(type(actual), type(expected))

Callers 15

test_countMethod · 0.95
test_findMethod · 0.95
test_rfindMethod · 0.95
test_indexMethod · 0.95
test_rindexMethod · 0.95
test_joinMethod · 0.95
test_replaceMethod · 0.95
test_islowerMethod · 0.95
test_isupperMethod · 0.95
test_istitleMethod · 0.95
test_isspaceMethod · 0.95

Calls 4

methodFunction · 0.85
usubClass · 0.85
assertTrueMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected