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?