(self, want: str, got: str, optionflags: int)
| 616 | ) |
| 617 | |
| 618 | def check_output(self, want: str, got: str, optionflags: int) -> bool: |
| 619 | if super().check_output(want, got, optionflags): |
| 620 | return True |
| 621 | |
| 622 | allow_unicode = optionflags & _get_allow_unicode_flag() |
| 623 | allow_bytes = optionflags & _get_allow_bytes_flag() |
| 624 | allow_number = optionflags & _get_number_flag() |
| 625 | |
| 626 | if not allow_unicode and not allow_bytes and not allow_number: |
| 627 | return False |
| 628 | |
| 629 | def remove_prefixes(regex: Pattern[str], txt: str) -> str: |
| 630 | return re.sub(regex, r"\1\2", txt) |
| 631 | |
| 632 | if allow_unicode: |
| 633 | want = remove_prefixes(self._unicode_literal_re, want) |
| 634 | got = remove_prefixes(self._unicode_literal_re, got) |
| 635 | |
| 636 | if allow_bytes: |
| 637 | want = remove_prefixes(self._bytes_literal_re, want) |
| 638 | got = remove_prefixes(self._bytes_literal_re, got) |
| 639 | |
| 640 | if allow_number: |
| 641 | got = self._remove_unwanted_precision(want, got) |
| 642 | |
| 643 | return super().check_output(want, got, optionflags) |
| 644 | |
| 645 | def _remove_unwanted_precision(self, want: str, got: str) -> str: |
| 646 | wants = list(self._number_re.finditer(want)) |
no test coverage detected