コード例 #1
0
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
コード例 #2
0
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
コード例 #3
0
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
コード例 #4
0
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