fix: using pytest.fail to test

This commit is contained in:
fbz 2025-07-06 16:24:52 +08:00
parent 1977c5b575
commit 40465d95c5

View File

@ -2093,9 +2093,7 @@ class TestMultipleChoiceField(FieldValues):
try: try:
json.dumps(validated) json.dumps(validated)
except TypeError as e: except TypeError as e:
assert ( pytest.fail(f'Validated output not JSON serializable: {repr(validated)}; Error: {e}')
False
), f'Validated output not JSON serializable: {repr(validated)}; Error: {e}'
def test_output_is_json_serializable(self): def test_output_is_json_serializable(self):
for output_value, _ in get_items(self.outputs): for output_value, _ in get_items(self.outputs):
@ -2104,7 +2102,7 @@ class TestMultipleChoiceField(FieldValues):
try: try:
json.dumps(representation) json.dumps(representation)
except TypeError as e: except TypeError as e:
assert False, ( pytest.fail(
f'to_representation output not JSON serializable: ' f'to_representation output not JSON serializable: '
f'{repr(representation)}; Error: {e}' f'{repr(representation)}; Error: {e}'
) )