Add repr(value) to the assert msg in FieldValues

This commit is contained in:
Ryan P Kilby 2017-09-11 05:18:39 -04:00
parent 71ad99e0b2
commit ae95ed1ec2

View File

@ -533,7 +533,8 @@ class FieldValues:
Ensure that valid values return the expected validated data.
"""
for input_value, expected_output in get_items(self.valid_inputs):
assert self.field.run_validation(input_value) == expected_output
assert self.field.run_validation(input_value) == expected_output, \
'input value: {}'.format(repr(input_value))
def test_invalid_inputs(self):
"""
@ -542,11 +543,13 @@ class FieldValues:
for input_value, expected_failure in get_items(self.invalid_inputs):
with pytest.raises(serializers.ValidationError) as exc_info:
self.field.run_validation(input_value)
assert exc_info.value.detail == expected_failure
assert exc_info.value.detail == expected_failure, \
'input value: {}'.format(repr(input_value))
def test_outputs(self):
for output_value, expected_output in get_items(self.outputs):
assert self.field.to_representation(output_value) == expected_output
assert self.field.to_representation(output_value) == expected_output, \
'output value: {}'.format(repr(output_value))
# Boolean types...