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

Method assertStartsWith

Lib/unittest/case.py:1474–1487  ·  view source on GitHub ↗
(self, s, prefix, msg=None)

Source from the content-addressed store, hash-verified

1472 f'Expected bytes, not {type(s).__name__}'))
1473
1474 def assertStartsWith(self, s, prefix, msg=None):
1475 try:
1476 if s.startswith(prefix):
1477 return
1478 except (AttributeError, TypeError):
1479 self._tail_type_check(s, prefix, msg)
1480 raise
1481 a = safe_repr(s, short=True)
1482 b = safe_repr(prefix)
1483 if isinstance(prefix, tuple):
1484 standardMsg = f"{a} doesn't start with any of {b}"
1485 else:
1486 standardMsg = f"{a} doesn't start with {b}"
1487 self.fail(self._formatMessage(msg, standardMsg))
1488
1489 def assertNotStartsWith(self, s, prefix, msg=None):
1490 try:

Calls 5

_tail_type_checkMethod · 0.95
failMethod · 0.95
_formatMessageMethod · 0.95
safe_reprFunction · 0.85
startswithMethod · 0.45