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

Method assertEndsWith

Lib/unittest/case.py:1505–1518  ·  view source on GitHub ↗
(self, s, suffix, msg=None)

Source from the content-addressed store, hash-verified

1503 self.fail(self._formatMessage(msg, f"{a} starts with {b}"))
1504
1505 def assertEndsWith(self, s, suffix, msg=None):
1506 try:
1507 if s.endswith(suffix):
1508 return
1509 except (AttributeError, TypeError):
1510 self._tail_type_check(s, suffix, msg)
1511 raise
1512 a = safe_repr(s, short=True)
1513 b = safe_repr(suffix)
1514 if isinstance(suffix, tuple):
1515 standardMsg = f"{a} doesn't end with any of {b}"
1516 else:
1517 standardMsg = f"{a} doesn't end with {b}"
1518 self.fail(self._formatMessage(msg, standardMsg))
1519
1520 def assertNotEndsWith(self, s, suffix, msg=None):
1521 try:

Callers 15

test_exception_tableMethod · 0.80
assertSigIntMethod · 0.80
verify_valid_flagMethod · 0.80
test_reprMethod · 0.80
test_reprMethod · 0.80

Calls 5

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

Tested by 15

test_exception_tableMethod · 0.64
assertSigIntMethod · 0.64
verify_valid_flagMethod · 0.64
test_reprMethod · 0.64
test_reprMethod · 0.64