mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-04-23 02:22:08 +03:00
apply black formatting
This commit is contained in:
parent
711d5cce45
commit
88091035a6
|
@ -153,5 +153,5 @@ def convert_serializer_field_to_list_of_enum(field):
|
|||
@get_graphene_type_from_serializer_field.register(serializers.ChoiceField)
|
||||
def convert_serializer_field_to_enum(field):
|
||||
# enums require a name
|
||||
name = field.field_name or field.source or 'Choices'
|
||||
name = field.field_name or field.source or "Choices"
|
||||
return convert_choices_to_named_enum_with_descriptions(name, field.choices)
|
||||
|
|
|
@ -61,8 +61,12 @@ def test_should_url_convert_string():
|
|||
|
||||
|
||||
def test_should_choice_convert_enum():
|
||||
field = assert_conversion(serializers.ChoiceField, graphene.Enum,
|
||||
choices=[('h', 'Hello'), ('w', 'World')], source='word')
|
||||
field = assert_conversion(
|
||||
serializers.ChoiceField,
|
||||
graphene.Enum,
|
||||
choices=[("h", "Hello"), ("w", "World")],
|
||||
source="word",
|
||||
)
|
||||
assert field._meta.enum.__members__["H"].value == "h"
|
||||
assert field._meta.enum.__members__["H"].description == "Hello"
|
||||
assert field._meta.enum.__members__["W"].value == "w"
|
||||
|
|
Loading…
Reference in New Issue
Block a user