def test_to_representation_item(): """ When given a valid item, the ListOrItemField to_representation method should utilize the item to-native logic. """ field = ListOrItemField(child=DateField(format=ISO_8601)) data = field.to_representation(date.today()) assert date.today().isoformat() == data
def test_to_representation_list(): """ When given a valid list, the ListOrItemField to_representation method should utilize the list to-native logic. """ field = ListOrItemField(child=DateField(format=ISO_8601)) data = field.to_representation([date.today()]) assert [date.today().isoformat()] == data