mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-15 18:52:27 +03:00
minor: rest old formatting
This commit is contained in:
parent
cfd4412a1e
commit
1977c5b575
|
@ -2059,17 +2059,17 @@ class TestMultipleChoiceField(FieldValues):
|
||||||
"""
|
"""
|
||||||
valid_inputs = {
|
valid_inputs = {
|
||||||
(): list(),
|
(): list(),
|
||||||
("aircon",): ["aircon"],
|
('aircon',): ['aircon'],
|
||||||
("aircon", "manual"): ["aircon", "manual"],
|
('aircon', 'manual'): ['aircon', 'manual'],
|
||||||
("manual", "aircon"): ["manual", "aircon"],
|
('manual', 'aircon'): ['manual', 'aircon'],
|
||||||
}
|
}
|
||||||
invalid_inputs = {
|
invalid_inputs = {
|
||||||
'abc': ['Expected a list of items but got type "str".'],
|
'abc': ['Expected a list of items but got type "str".'],
|
||||||
('aircon', 'incorrect'): ['"incorrect" is not a valid choice.']
|
('aircon', 'incorrect'): ['"incorrect" is not a valid choice.']
|
||||||
}
|
}
|
||||||
outputs = [
|
outputs = [
|
||||||
(["aircon", "manual", "incorrect"], ["aircon", "manual", "incorrect"]),
|
(['aircon', 'manual', 'incorrect'], ['aircon', 'manual', 'incorrect']),
|
||||||
(["manual", "aircon", "incorrect"], ["manual", "aircon", "incorrect"]),
|
(['manual', 'aircon', 'incorrect'], ['manual', 'aircon', 'incorrect']),
|
||||||
]
|
]
|
||||||
field = serializers.MultipleChoiceField(
|
field = serializers.MultipleChoiceField(
|
||||||
choices=[
|
choices=[
|
||||||
|
@ -2084,7 +2084,7 @@ class TestMultipleChoiceField(FieldValues):
|
||||||
field.partial = False
|
field.partial = False
|
||||||
assert field.get_value(QueryDict('')) == []
|
assert field.get_value(QueryDict('')) == []
|
||||||
field.partial = True
|
field.partial = True
|
||||||
assert field.get_value(QueryDict("")) == rest_framework.fields.empty
|
assert field.get_value(QueryDict('')) == rest_framework.fields.empty
|
||||||
|
|
||||||
def test_valid_inputs_is_json_serializable(self):
|
def test_valid_inputs_is_json_serializable(self):
|
||||||
for input_value, _ in get_items(self.valid_inputs):
|
for input_value, _ in get_items(self.valid_inputs):
|
||||||
|
@ -2095,7 +2095,7 @@ class TestMultipleChoiceField(FieldValues):
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
assert (
|
assert (
|
||||||
False
|
False
|
||||||
), f"Validated output not JSON serializable: {repr(validated)}; Error: {e}"
|
), 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):
|
||||||
|
@ -2105,8 +2105,8 @@ class TestMultipleChoiceField(FieldValues):
|
||||||
json.dumps(representation)
|
json.dumps(representation)
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
assert False, (
|
assert False, (
|
||||||
f"to_representation output not JSON serializable: "
|
f'to_representation output not JSON serializable: '
|
||||||
f"{repr(representation)}; Error: {e}"
|
f'{repr(representation)}; Error: {e}'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user