diff --git a/graphene/tests/issues/test_956.py b/graphene/tests/issues/test_956.py new file mode 100644 index 00000000..72ff9713 --- /dev/null +++ b/graphene/tests/issues/test_956.py @@ -0,0 +1,8 @@ +import graphene + + +def test_issue(): + options = {"description": "This my enum", "deprecation_reason": "For the funs"} + new_enum = graphene.Enum("MyEnum", [("some", "data")], **options) + assert new_enum._meta.description == options["description"] + assert new_enum._meta.deprecation_reason == options["deprecation_reason"] diff --git a/graphene/types/enum.py b/graphene/types/enum.py index 6e6bab8f..7b8e71f5 100644 --- a/graphene/types/enum.py +++ b/graphene/types/enum.py @@ -46,7 +46,12 @@ class EnumMeta(SubclassWithMeta_Meta): def __call__(cls, *args, **kwargs): # noqa: N805 if cls is Enum: description = kwargs.pop("description", None) - return cls.from_enum(PyEnum(*args, **kwargs), description=description) + deprecation_reason = kwargs.pop("deprecation_reason", None) + return cls.from_enum( + PyEnum(*args, **kwargs), + description=description, + deprecation_reason=deprecation_reason, + ) return super(EnumMeta, cls).__call__(*args, **kwargs) # return cls._meta.enum(*args, **kwargs)