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

Method assertIs

Lib/unittest/case.py:1201–1206  ·  view source on GitHub ↗

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

(self, expr1, expr2, msg=None)

Source from the content-addressed store, hash-verified

1199 self.fail(self._formatMessage(msg, standardMsg))
1200
1201 def assertIs(self, expr1, expr2, msg=None):
1202 """Just like self.assertTrue(a is b), but with a nicer default message."""
1203 if expr1 is not expr2:
1204 standardMsg = '%s is not %s' % (safe_repr(expr1),
1205 safe_repr(expr2))
1206 self.fail(self._formatMessage(msg, standardMsg))
1207
1208 def assertIsNot(self, expr1, expr2, msg=None):
1209 """Just like self.assertTrue(a is not b), but with a nicer default message."""

Calls 3

failMethod · 0.95
_formatMessageMethod · 0.95
safe_reprFunction · 0.85