From d273922a2e94b55d6ef9e6ee3997740aa323f111 Mon Sep 17 00:00:00 2001 From: u243606 Date: Wed, 5 Apr 2023 12:18:36 +0530 Subject: [PATCH] Fix(register): updated register_enum function support custom classes Use isinstance instead of type to support instances of enum class in addition to exact same type. --- graphene_mongo/registry.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/graphene_mongo/registry.py b/graphene_mongo/registry.py index bed3e63f..8d57713e 100644 --- a/graphene_mongo/registry.py +++ b/graphene_mongo/registry.py @@ -26,9 +26,9 @@ def register(self, cls): def register_enum(self, cls): from enum import EnumMeta - assert type(cls) == EnumMeta, 'Only EnumMeta can be registered, received "{}"'.format( - cls.__name__ - ) + assert isinstance( + cls, EnumMeta + ), f'Only EnumMeta can be registered, received "{cls.__name__}"' if not cls.__name__.endswith('Enum'): name = cls.__name__ + 'Enum' else: