Ejemplo n.º 1
0
def test_get_data_inventory():
    dl = DataLoader()
    file_names = dl.get_data_inventory()
    assert set(file_names) == {
        "online_retail", "minute_energy_appliance", "minute_household_power",
        "minute_yosemite_temps", "hourly_parking", "hourly_traffic_volume",
        "hourly_bikesharing", "hourly_beijing_pm",
        "daily_temperature_australia", "daily_demand_order",
        "daily_female_births", "daily_istanbul_stock", "daily_peyton_manning",
        "monthly_shampoo", "monthly_sunspot"
    }
Ejemplo n.º 2
0
def test_load_data():
    dl = DataLoader()
    df = dl.load_data(data_name="daily_peyton_manning")
    expected_df = dl.load_peyton_manning()
    assert_equal(df, expected_df)

    df = dl.load_data(data_name="hourly_parking", system_code_number="Shopping")
    expected_df = dl.load_parking(system_code_number="Shopping")
    assert_equal(df, expected_df)

    # Error due to unavailable data name
    data_name = "dummy"
    data_inventory = dl.get_data_inventory()
    with pytest.raises(ValueError, match=fr"Input data name '{data_name}' is not recognized. "
                                         fr"Must be one of \{data_inventory}\."):
        dl.load_data(data_name=data_name)
Ejemplo n.º 3
0
def test_init():
    dl = DataLoader()
    assert dl.available_datasets == dl.get_data_inventory()