anikolaienko/py-automapper

Dict mapping throws Exception

damjan-icentic opened this issue · 2 comments

If source objects contains dict attribute like
enums = { "enmu0": "some value", "enum1": "some other value" }
automapper throws
ValueError: too many values to unpack (expected 2)
I guess the problem is this part of code:
if is_sequence(obj): if isinstance(obj, dict): result = { k: self._map_subobject( v, _visited_stack, skip_none_values=skip_none_values ) for k, v in obj }
I think it should be for k, v in obj.items()

Oh, that's interesting, let me take a look at it this week and I'll try to fix it.
Or you are welcome to submit a Pull Request with changes :)

@damjan-icentic Thank you so much for pointing out the issue. It is fixed in the latest published release.
Here is the test case: https://github.com/anikolaienko/py-automapper/blob/main/tests/test_automapper_dict_field.py