Skip to content

Commit 5583acb

Browse files
author
Barry Barrette
committed
Migrate unit test to feature test
1 parent f6cd797 commit 5583acb

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

end_to_end_tests/functional_tests/generated_code_execution/test_enums_and_consts.py

+29
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,35 @@ def test_invalid_values(self, MyModel):
129129
MyModel.from_dict({"enumProp": "a"})
130130

131131

132+
@with_generated_client_fixture(
133+
"""
134+
components:
135+
schemas:
136+
MyEnum:
137+
type: integer
138+
enum: [2, 3, -4]
139+
x-enum-varnames: [
140+
"Two",
141+
"Three",
142+
"Negative Four"
143+
]
144+
""")
145+
@with_generated_code_imports(
146+
".models.MyEnum",
147+
)
148+
class TestIntEnumVarNameExtensions:
149+
@pytest.mark.parametrize(
150+
"expected_name,expected_value",
151+
[
152+
("TWO", 2),
153+
("THREE", 3),
154+
("NEGATIVE_FOUR", -4),
155+
],
156+
)
157+
def test_enum_values(self, MyEnum, expected_name, expected_value):
158+
assert getattr(MyEnum, expected_name) == MyEnum(expected_value)
159+
160+
132161
@with_generated_client_fixture(
133162
"""
134163
components:

0 commit comments

Comments
 (0)