-
-
Notifications
You must be signed in to change notification settings - Fork 7k
fix: MultipleChoiceField use ordered sort #9735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
cc77c10
3e09113
0ee24d5
cfd4412
1977c5b
40465d9
fab5f77
bbc27c0
57f1dd2
4945737
74ee942
f580b11
06c3aa5
91063d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -199,14 +199,14 @@ def test_nested_serializer_with_list_json(self): | |
| serializer = self.Serializer(data=input_data) | ||
|
|
||
| assert serializer.is_valid() | ||
| assert serializer.validated_data['nested']['example'] == {1, 2} | ||
| assert serializer.validated_data['nested']['example'] == [1, 2] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hum, that's a bit unfortunate that this data type is exposed at this level. I'm thinking of potential users testing at the serializer level might get some new test failures with this change.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think we just need to note in the new version's documentation that the return type is a list, so that if a user upgrades and their tests fail, they'll know exactly what to look at. Since the input, as mentioned in the signature, is already an ordered sequence (a list or a tuple), it would be much more user-friendly if the output keeps that same order. |
||
|
|
||
| def test_nested_serializer_with_list_multipart(self): | ||
| input_data = QueryDict('nested.example=1&nested.example=2') | ||
| serializer = self.Serializer(data=input_data) | ||
|
|
||
| assert serializer.is_valid() | ||
| assert serializer.validated_data['nested']['example'] == {1, 2} | ||
| assert serializer.validated_data['nested']['example'] == [1, 2] | ||
|
|
||
|
|
||
| class TestNotRequiredNestedSerializerWithMany: | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.