Added test for to_dict and from_dict.