apply black formatting

This commit is contained in:
Jason Kraus 2019-08-06 12:18:17 -07:00
parent 711d5cce45
commit 88091035a6
2 changed files with 7 additions and 3 deletions

View File

@ -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)

View File

@ -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"