mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-03 12:00:12 +03:00
Use “Must be…” wording
as per review from @tomchristie.
This commit is contained in:
parent
f28708d674
commit
6cf6ff9537
|
@ -642,7 +642,7 @@ class Field(object):
|
||||||
|
|
||||||
class BooleanField(Field):
|
class BooleanField(Field):
|
||||||
default_error_messages = {
|
default_error_messages = {
|
||||||
'invalid': _('Is not a valid boolean.')
|
'invalid': _('Must be a valid boolean.')
|
||||||
}
|
}
|
||||||
default_empty_html = False
|
default_empty_html = False
|
||||||
initial = False
|
initial = False
|
||||||
|
@ -687,7 +687,7 @@ class BooleanField(Field):
|
||||||
|
|
||||||
class NullBooleanField(Field):
|
class NullBooleanField(Field):
|
||||||
default_error_messages = {
|
default_error_messages = {
|
||||||
'invalid': _('Is not a valid boolean.')
|
'invalid': _('Must be a valid boolean.')
|
||||||
}
|
}
|
||||||
initial = None
|
initial = None
|
||||||
TRUE_VALUES = {
|
TRUE_VALUES = {
|
||||||
|
@ -841,7 +841,7 @@ class UUIDField(Field):
|
||||||
valid_formats = ('hex_verbose', 'hex', 'int', 'urn')
|
valid_formats = ('hex_verbose', 'hex', 'int', 'urn')
|
||||||
|
|
||||||
default_error_messages = {
|
default_error_messages = {
|
||||||
'invalid': _('Is not a valid UUID.'),
|
'invalid': _('Must be a valid UUID.'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
|
|
@ -573,7 +573,7 @@ class TestBooleanField(FieldValues):
|
||||||
False: False,
|
False: False,
|
||||||
}
|
}
|
||||||
invalid_inputs = {
|
invalid_inputs = {
|
||||||
'foo': ['Is not a valid boolean.'],
|
'foo': ['Must be a valid boolean.'],
|
||||||
None: ['This field may not be null.']
|
None: ['This field may not be null.']
|
||||||
}
|
}
|
||||||
outputs = {
|
outputs = {
|
||||||
|
@ -598,7 +598,7 @@ class TestBooleanField(FieldValues):
|
||||||
for input_value in inputs:
|
for input_value in inputs:
|
||||||
with pytest.raises(serializers.ValidationError) as exc_info:
|
with pytest.raises(serializers.ValidationError) as exc_info:
|
||||||
field.run_validation(input_value)
|
field.run_validation(input_value)
|
||||||
expected = ['Is not a valid boolean.'.format(input_value)]
|
expected = ['Must be a valid boolean.'.format(input_value)]
|
||||||
assert exc_info.value.detail == expected
|
assert exc_info.value.detail == expected
|
||||||
|
|
||||||
|
|
||||||
|
@ -615,7 +615,7 @@ class TestNullBooleanField(TestBooleanField):
|
||||||
None: None
|
None: None
|
||||||
}
|
}
|
||||||
invalid_inputs = {
|
invalid_inputs = {
|
||||||
'foo': ['Is not a valid boolean.'],
|
'foo': ['Must be a valid boolean.'],
|
||||||
}
|
}
|
||||||
outputs = {
|
outputs = {
|
||||||
'true': True,
|
'true': True,
|
||||||
|
@ -759,8 +759,8 @@ class TestUUIDField(FieldValues):
|
||||||
284758210125106368185219588917561929842: uuid.UUID('d63a6fb6-88d5-40c7-a91c-9edf73283072')
|
284758210125106368185219588917561929842: uuid.UUID('d63a6fb6-88d5-40c7-a91c-9edf73283072')
|
||||||
}
|
}
|
||||||
invalid_inputs = {
|
invalid_inputs = {
|
||||||
'825d7aeb-05a9-45b5-a5b7': ['Is not a valid UUID.'],
|
'825d7aeb-05a9-45b5-a5b7': ['Must be a valid UUID.'],
|
||||||
(1, 2, 3): ['Is not a valid UUID.']
|
(1, 2, 3): ['Must be a valid UUID.']
|
||||||
}
|
}
|
||||||
outputs = {
|
outputs = {
|
||||||
uuid.UUID('825d7aeb-05a9-45b5-a5b7-05df87923cda'): '825d7aeb-05a9-45b5-a5b7-05df87923cda'
|
uuid.UUID('825d7aeb-05a9-45b5-a5b7-05df87923cda'): '825d7aeb-05a9-45b5-a5b7-05df87923cda'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user