| 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: |