def test_fetch(mocker, single_site, start, end, exp): rd = mocker.patch( 'solarforecastarbiter.io.reference_observations.srml.request_data', return_value=None) srml.fetch('', single_site, start, end) year_month = [(ca[0][1], ca[0][2]) for ca in rd.call_args_list] assert year_month == exp
def test_fetch_power_conversion(mocker, single_site, start, end, test_data): mocker.patch( 'solarforecastarbiter.io.reference_observations.srml.request_data', return_value=test_data) data = srml.fetch('', single_site, start, end) assert not [col for col in data.columns if '_flag' in col] assert data['5161'].iloc[0] == 0.000235 assert data['5162'].iloc[0] == 0.000250
def test_fetch_tz(single_site): start = dt.datetime(2019, 1, 1, tzinfo=dt.timezone.utc) with pytest.raises(TypeError): srml.fetch('', single_site, start, dt.datetime(2019, 2, 1))