def test_from_dict(dictionary): subc = SubrecordCollection.from_dict(dictionary) assert isinstance(subc, SubrecordCollection) assert subc.name == dictionary["name"] assert subc.items == [ SubrecordCollection.from_dict(item) if "items" in item else Subrecord.from_dict(item) for item in dictionary["items"] ] assert subc.optional == dictionary["optional"] assert subc.multiple == dictionary["multiple"]
def test_to_dict(dictionary): subc = SubrecordCollection.from_dict(dictionary) assert isinstance(subc, SubrecordCollection) assert subc.to_dict() == dictionary