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