mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
update expected error messages in tests
This commit is contained in:
parent
a90ba2bc11
commit
32506e2075
|
@ -640,8 +640,8 @@ class TestDateField(FieldValues):
|
|||
datetime.date(2001, 1, 1): datetime.date(2001, 1, 1),
|
||||
}
|
||||
invalid_inputs = {
|
||||
'abc': ['Date has wrong format. Use one of these formats instead: YYYY[-MM[-DD]]'],
|
||||
'2001-99-99': ['Date has wrong format. Use one of these formats instead: YYYY[-MM[-DD]]'],
|
||||
'abc': ['Date has wrong format. Use one of these formats instead: YYYY[-MM[-DD]].'],
|
||||
'2001-99-99': ['Date has wrong format. Use one of these formats instead: YYYY[-MM[-DD]].'],
|
||||
datetime.datetime(2001, 1, 1, 12, 00): ['Expected a date but got a datetime.'],
|
||||
}
|
||||
outputs = {
|
||||
|
@ -658,7 +658,7 @@ class TestCustomInputFormatDateField(FieldValues):
|
|||
'1 Jan 2001': datetime.date(2001, 1, 1),
|
||||
}
|
||||
invalid_inputs = {
|
||||
'2001-01-01': ['Date has wrong format. Use one of these formats instead: DD [Jan-Dec] YYYY']
|
||||
'2001-01-01': ['Date has wrong format. Use one of these formats instead: DD [Jan-Dec] YYYY.']
|
||||
}
|
||||
outputs = {}
|
||||
field = serializers.DateField(input_formats=['%d %b %Y'])
|
||||
|
@ -702,8 +702,8 @@ class TestDateTimeField(FieldValues):
|
|||
'2001-01-01T14:00+01:00' if (django.VERSION > (1, 4)) else '2001-01-01T13:00Z': datetime.datetime(2001, 1, 1, 13, 00, tzinfo=timezone.UTC())
|
||||
}
|
||||
invalid_inputs = {
|
||||
'abc': ['Datetime has wrong format. Use one of these formats instead: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z]'],
|
||||
'2001-99-99T99:00': ['Datetime has wrong format. Use one of these formats instead: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z]'],
|
||||
'abc': ['Datetime has wrong format. Use one of these formats instead: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z].'],
|
||||
'2001-99-99T99:00': ['Datetime has wrong format. Use one of these formats instead: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z].'],
|
||||
datetime.date(2001, 1, 1): ['Expected a datetime but got a date.'],
|
||||
}
|
||||
outputs = {
|
||||
|
@ -721,7 +721,7 @@ class TestCustomInputFormatDateTimeField(FieldValues):
|
|||
'1:35pm, 1 Jan 2001': datetime.datetime(2001, 1, 1, 13, 35, tzinfo=timezone.UTC()),
|
||||
}
|
||||
invalid_inputs = {
|
||||
'2001-01-01T20:50': ['Datetime has wrong format. Use one of these formats instead: hh:mm[AM|PM], DD [Jan-Dec] YYYY']
|
||||
'2001-01-01T20:50': ['Datetime has wrong format. Use one of these formats instead: hh:mm[AM|PM], DD [Jan-Dec] YYYY.']
|
||||
}
|
||||
outputs = {}
|
||||
field = serializers.DateTimeField(default_timezone=timezone.UTC(), input_formats=['%I:%M%p, %d %b %Y'])
|
||||
|
@ -773,8 +773,8 @@ class TestTimeField(FieldValues):
|
|||
datetime.time(13, 00): datetime.time(13, 00),
|
||||
}
|
||||
invalid_inputs = {
|
||||
'abc': ['Time has wrong format. Use one of these formats instead: hh:mm[:ss[.uuuuuu]]'],
|
||||
'99:99': ['Time has wrong format. Use one of these formats instead: hh:mm[:ss[.uuuuuu]]'],
|
||||
'abc': ['Time has wrong format. Use one of these formats instead: hh:mm[:ss[.uuuuuu]].'],
|
||||
'99:99': ['Time has wrong format. Use one of these formats instead: hh:mm[:ss[.uuuuuu]].'],
|
||||
}
|
||||
outputs = {
|
||||
datetime.time(13, 00): '13:00:00'
|
||||
|
@ -790,7 +790,7 @@ class TestCustomInputFormatTimeField(FieldValues):
|
|||
'1:00pm': datetime.time(13, 00),
|
||||
}
|
||||
invalid_inputs = {
|
||||
'13:00': ['Time has wrong format. Use one of these formats instead: hh:mm[AM|PM]'],
|
||||
'13:00': ['Time has wrong format. Use one of these formats instead: hh:mm[AM|PM].'],
|
||||
}
|
||||
outputs = {}
|
||||
field = serializers.TimeField(input_formats=['%I:%M%p'])
|
||||
|
@ -1028,7 +1028,7 @@ class TestListField(FieldValues):
|
|||
(['1', '2', '3'], [1, 2, 3])
|
||||
]
|
||||
invalid_inputs = [
|
||||
('not a list', ['Expected a list of items but got type `str`']),
|
||||
('not a list', ['Expected a list of items but got type `str`.']),
|
||||
([1, 2, 'error'], ['A valid integer is required.'])
|
||||
]
|
||||
outputs = [
|
||||
|
|
Loading…
Reference in New Issue
Block a user