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

Method assertIn

Lib/unittest/case.py:1187–1192  ·  view source on GitHub ↗

Just like self.assertTrue(a in b), but with a nicer default message.

(self, member, container, msg=None)

Source from the content-addressed store, hash-verified

1185 self.fail(self._formatMessage(msg, standardMsg))
1186
1187 def assertIn(self, member, container, msg=None):
1188 """Just like self.assertTrue(a in b), but with a nicer default message."""
1189 if member not in container:
1190 standardMsg = '%s not found in %s' % (safe_repr(member),
1191 safe_repr(container))
1192 self.fail(self._formatMessage(msg, standardMsg))
1193
1194 def assertNotIn(self, member, container, msg=None):
1195 """Just like self.assertTrue(a not in b), but with a nicer default message."""

Calls 3

failMethod · 0.95
_formatMessageMethod · 0.95
safe_reprFunction · 0.85

Tested by 15

test_globalMethod · 0.76
test_in_and_not_inMethod · 0.76
test_keyencodingMethod · 0.76
test_eq_orderMethod · 0.76
test_class_markerMethod · 0.76
test_missing_reprMethod · 0.76