from_dict and to_dict tests.