Skip to content

Mapping to and from a class with a custom metaclass is not allowed #19

@toro2k

Description

@toro2k

The following the case fails:

from unittest import TestCase
from mapper.object_mapper import ObjectMapper

class MyMetaClass(type):
    pass

class MyFromClass(metaclass=MyMetaClass):
    pass

class MyToClass:
    pass

class Test(TestCase):
    def test_mapping_class_with_custom_metaclass(self):
        mapper = ObjectMapper()
        mapper.create_map(MyFromClass, MyToClass)

This behavior prevents to map to and from classes with a custom metaclass (i.e. Django models).
Is it intended or the check in ObjectMapper.create_map is just too strict?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions