mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 09:42:32 +03:00
Add test and documentation note
That setting to an empty list is the same as setting the value as False
This commit is contained in:
parent
380ad94b3b
commit
448802b2b6
|
@ -153,6 +153,9 @@ automatically converted into enums:
|
|||
model = PetModel
|
||||
convert_choices_to_enum = ['kind']
|
||||
|
||||
**Note:** Setting ``convert_choices_to_enum`` to an empty list is the same as
|
||||
setting it to `False`.
|
||||
|
||||
|
||||
Related models
|
||||
--------------
|
||||
|
|
|
@ -303,3 +303,32 @@ class TestDjangoObjectType:
|
|||
}
|
||||
"""
|
||||
)
|
||||
|
||||
def test_django_objecttype_convert_choices_enum_empty_list(self, PetModel):
|
||||
class Pet(DjangoObjectType):
|
||||
class Meta:
|
||||
model = PetModel
|
||||
convert_choices_to_enum = []
|
||||
|
||||
class Query(ObjectType):
|
||||
pet = Field(Pet)
|
||||
|
||||
schema = Schema(query=Query)
|
||||
|
||||
assert str(schema) == dedent(
|
||||
"""\
|
||||
schema {
|
||||
query: Query
|
||||
}
|
||||
|
||||
type Pet {
|
||||
id: ID!
|
||||
kind: String!
|
||||
cuteness: Int!
|
||||
}
|
||||
|
||||
type Query {
|
||||
pet: Pet
|
||||
}
|
||||
"""
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user