mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-18 03:52:24 +03:00
Add test for iterable enum instance creation and move tests to test_enum.py
This commit is contained in:
parent
88fe5c2ea1
commit
ca64b5175c
|
@ -1,13 +0,0 @@
|
|||
from graphene.types.enum import Enum
|
||||
|
||||
|
||||
def test_enum_iteration():
|
||||
class TestEnum(Enum):
|
||||
FIRST = 1
|
||||
SECOND = 2
|
||||
|
||||
result = []
|
||||
expected_values = ["FIRST", "SECOND"]
|
||||
for c in TestEnum:
|
||||
result.append(c.name)
|
||||
assert result == expected_values
|
|
@ -543,3 +543,25 @@ def test_hashable_instance_creation_enum():
|
|||
assert trilogy_map[Episode.NEWHOPE] == "better"
|
||||
assert trilogy_map[Episode.EMPIRE] == "best"
|
||||
assert trilogy_map[5] == "foo"
|
||||
|
||||
|
||||
def test_enum_iteration():
|
||||
class TestEnum(Enum):
|
||||
FIRST = 1
|
||||
SECOND = 2
|
||||
|
||||
result = []
|
||||
expected_values = ["FIRST", "SECOND"]
|
||||
for c in TestEnum:
|
||||
result.append(c.name)
|
||||
assert result == expected_values
|
||||
|
||||
|
||||
def test_iterable_instance_creation_enum():
|
||||
TestEnum = Enum("TestEnum", [("FIRST", 1), ("SECOND", 2)])
|
||||
|
||||
result = []
|
||||
expected_values = ["FIRST", "SECOND"]
|
||||
for c in TestEnum:
|
||||
result.append(c.name)
|
||||
assert result == expected_values
|
||||
|
|
Loading…
Reference in New Issue
Block a user