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

Method test_implementation

Lib/test/test_userstring.py:150–162  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

148 self.checkraises(UnicodeError, '\ud800', 'encode', None, None)
149
150 def test_implementation(self):
151 s = UserString('ababahalamaha')
152 with support.swap_attr(UserString, '__iter__', None):
153 c = s.count('a')
154 c2 = s.count(UserString('a'))
155 self.assertEqual(c, 7)
156 self.assertEqual(c2, 7)
157 with (support.swap_attr(UserString, '__iter__', None),
158 support.swap_attr(UserString, '__getitem__', None)):
159 i = s.index('h')
160 i2 = s.index(UserString('h'))
161 self.assertEqual(i, 5)
162 self.assertEqual(i2, 5)
163
164
165if __name__ == "__main__":

Callers

nothing calls this directly

Calls 4

countMethod · 0.95
indexMethod · 0.95
UserStringClass · 0.90
assertEqualMethod · 0.45

Tested by

no test coverage detected