diff --git a/rest_framework/fields.py b/rest_framework/fields.py index ad710b9678..28eca13e67 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -642,7 +642,7 @@ def __repr__(self): class BooleanField(Field): default_error_messages = { - 'invalid': _('"{input}" is not a valid boolean.') + 'invalid': _('Must be a valid boolean.') } default_empty_html = False initial = False @@ -687,7 +687,7 @@ def to_representation(self, value): class NullBooleanField(Field): default_error_messages = { - 'invalid': _('"{input}" is not a valid boolean.') + 'invalid': _('Must be a valid boolean.') } initial = None TRUE_VALUES = { @@ -841,7 +841,7 @@ class UUIDField(Field): valid_formats = ('hex_verbose', 'hex', 'int', 'urn') default_error_messages = { - 'invalid': _('"{value}" is not a valid UUID.'), + 'invalid': _('Must be a valid UUID.'), } def __init__(self, **kwargs): diff --git a/tests/test_fields.py b/tests/test_fields.py index 6a694092ac..d49dab889f 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -573,7 +573,7 @@ class TestBooleanField(FieldValues): False: False, } invalid_inputs = { - 'foo': ['"foo" is not a valid boolean.'], + 'foo': ['Must be a valid boolean.'], None: ['This field may not be null.'] } outputs = { @@ -598,7 +598,7 @@ def test_disallow_unhashable_collection_types(self): for input_value in inputs: with pytest.raises(serializers.ValidationError) as exc_info: field.run_validation(input_value) - expected = ['"{0}" is not a valid boolean.'.format(input_value)] + expected = ['Must be a valid boolean.'.format(input_value)] assert exc_info.value.detail == expected @@ -615,7 +615,7 @@ class TestNullBooleanField(TestBooleanField): None: None } invalid_inputs = { - 'foo': ['"foo" is not a valid boolean.'], + 'foo': ['Must be a valid boolean.'], } outputs = { 'true': True, @@ -759,8 +759,8 @@ class TestUUIDField(FieldValues): 284758210125106368185219588917561929842: uuid.UUID('d63a6fb6-88d5-40c7-a91c-9edf73283072') } invalid_inputs = { - '825d7aeb-05a9-45b5-a5b7': ['"825d7aeb-05a9-45b5-a5b7" is not a valid UUID.'], - (1, 2, 3): ['"(1, 2, 3)" is not a valid UUID.'] + '825d7aeb-05a9-45b5-a5b7': ['Must be a valid UUID.'], + (1, 2, 3): ['Must be a valid UUID.'] } outputs = { uuid.UUID('825d7aeb-05a9-45b5-a5b7-05df87923cda'): '825d7aeb-05a9-45b5-a5b7-05df87923cda' pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy