mikeywaites / kim

Kim: A JSON Serialization and Marshaling framework
http://kim.readthedocs.org/en/latest/
Other
317 stars 17 forks source link

Mapper inheritance #178

Open dimonji opened 5 years ago

dimonji commented 5 years ago

Hi, I have some problems

# -*- coding: utf-8 -*-
from kim import field, Mapper

class A(Mapper):
    __type__ = dict

    a = field.Integer()

class B(Mapper):
    __type__ = dict

    b = field.Integer()

class C(A, B):
    __type__ = dict

    c = field.Integer()

sample = {'a': 1, 'b': 2, 'c': 3}
print('serialized', C(obj=sample).serialize())
print('marshalled', C(data=sample).marshal())

Output is:

python3.7 mapper_test.py
{'a': 1, 'c': 3}
{'a': 1, 'c': 3}

Process finished with exit code 0

Is can Kim have right way to create mapper from inheritance?