test_classes: Merge verbose assertEquals into ZulipTestCase.

This commit is contained in:
Alex Vandiver
2024-07-19 17:36:04 +00:00
committed by Tim Abbott
parent e1d35b1e72
commit 94ff443c00
2 changed files with 29 additions and 31 deletions

View File

@@ -279,6 +279,18 @@ Output:
token=r"[a-z0-9_]{24}"
)
@override
def assertEqual(self, first: Any, second: Any, msg: Any = "") -> None:
if isinstance(first, str) and isinstance(second, str):
if first != second:
raise AssertionError(
"Actual and expected outputs do not match; showing diff.\n"
+ diff_strings(first, second)
+ str(msg)
)
else:
super().assertEqual(first, second, msg)
def set_http_headers(self, extra: dict[str, str], skip_user_agent: bool = False) -> None:
if "subdomain" in extra:
assert isinstance(extra["subdomain"], str)
@@ -2162,20 +2174,6 @@ class ZulipTestCase(ZulipTestCaseMixin, TestCase):
return message_id
class ZulipVerboseEqualTestCase(ZulipTestCase):
@override
def assertEqual(self, first: Any, second: Any, msg: str = "") -> None:
if isinstance(first, str) and isinstance(second, str):
if first != second:
raise AssertionError(
"Actual and expected outputs do not match; showing diff.\n"
+ diff_strings(first, second)
+ msg
)
else:
super().assertEqual(first, second)
def get_row_ids_in_all_tables() -> Iterator[tuple[str, set[int]]]:
all_models = apps.get_models(include_auto_created=True)
ignored_tables = {"django_session"}