Esempio n. 1
0
def test_equal():
    """
    test_equal: check if __eq__ functions
    """
    assert MINIMAL_FA == MINIMAL_FA
    assert MINIMAL_FA != FULL_FA
    assert FULL_FA != MINIMAL_FA
    assert FULL_FA == FULL_FA
    assert MINIMAL_FA != "MINIMAL_FA"

    temp_dict = MINIMAL_FA_DICT.copy()
    temp_dict["fare_id"] = 2
    temp_fare_attribute = FareAttribute.from_dict(temp_dict)

    assert temp_fare_attribute != MINIMAL_FA
Esempio n. 2
0
    "currency_type": "EUR",
    "payment_method": "1",
    "transfers": "4"
}

FULL_FA_DICT = {
    "fare_id": "132",
    "price": "0.51",
    "currency_type": "USD",
    "payment_method": "0",
    "transfers": "0",
    "agency_id": "123",
    "transfer_duration": "3600"
}

MINIMAL_FA = FareAttribute.from_dict(MINIMAL_FA_DICT)
FULL_FA = FareAttribute.from_dict(FULL_FA_DICT)


def test_fare_attribute_happyflow_minimal():
    """
    test_fare_attribute_happyflow_minimal: minimal, correct example
    """
    fare_attribute = FareAttribute.from_gtfs(MINIMAL_FA_DICT.keys(),
                                             MINIMAL_FA_DICT.values())
    assert fare_attribute == MINIMAL_FA


def test_fare_attribute_happyflow_full():
    """
    test_fare_attribute_happyflow_full: full, correct example