|
132 | 132 | 'WS10m': {'description': '10-m total wind speed', 'units': 'm/s'}, # noqa: E501
|
133 | 133 | 'Int': {'description': '1 means solar radiation values are reconstructed'}}}}} # noqa: E501
|
134 | 134 |
|
| 135 | +descriptions_csv = metadata_radiation_csv.copy() |
| 136 | +metadata_radiation_csv = {} |
| 137 | +metadata_radiation_csv['descriptions'] = descriptions_csv |
| 138 | +metadata_radiation_csv['inputs'] = inputs_radiation_csv |
| 139 | + |
| 140 | +descriptions_json = metadata_pv_json['inputs'] |
| 141 | +metadata_pv_json['inputs'] = inputs_pv_json |
| 142 | +metadata_pv_json['inputs']['descriptions'] = descriptions_json |
| 143 | + |
135 | 144 |
|
136 | 145 | def generate_expected_dataframe(values, columns, index):
|
137 | 146 | """Create dataframe from arrays of values, columns and index, in order to
|
@@ -175,25 +184,24 @@ def expected_pv_json_mapped():
|
175 | 184 | # Test read_pvgis_hourly function using two different files with different
|
176 | 185 | # input arguments (to test variable mapping and pvgis_format)
|
177 | 186 | # pytest request.getfixturevalue is used to simplify the input arguments
|
178 |
| -@pytest.mark.parametrize('testfile,expected_name,metadata_exp,inputs_exp,map_variables,pvgis_format', [ # noqa: E501 |
| 187 | +@pytest.mark.parametrize('testfile,expected_name,metadata_exp,map_variables,pvgis_format', [ # noqa: E501 |
179 | 188 | (testfile_radiation_csv, 'expected_radiation_csv', metadata_radiation_csv,
|
180 |
| - inputs_radiation_csv, False, None), |
| 189 | + False, None), |
181 | 190 | (testfile_radiation_csv, 'expected_radiation_csv_mapped',
|
182 |
| - metadata_radiation_csv, inputs_radiation_csv, True, 'csv'), |
183 |
| - (testfile_pv_json, 'expected_pv_json', metadata_pv_json, inputs_pv_json, |
| 191 | + metadata_radiation_csv, True, 'csv'), |
| 192 | + (testfile_pv_json, 'expected_pv_json', metadata_pv_json, |
184 | 193 | False, None),
|
185 | 194 | (testfile_pv_json, 'expected_pv_json_mapped', metadata_pv_json,
|
186 |
| - inputs_pv_json, True, 'json')]) |
| 195 | + True, 'json')]) |
187 | 196 | def test_read_pvgis_hourly(testfile, expected_name, metadata_exp,
|
188 |
| - inputs_exp, map_variables, pvgis_format, request): |
| 197 | + map_variables, pvgis_format, request): |
189 | 198 | # Get expected dataframe from fixture
|
190 | 199 | expected = request.getfixturevalue(expected_name)
|
191 | 200 | # Read data from file
|
192 |
| - out, inputs, metadata = read_pvgis_hourly( |
| 201 | + out, metadata = read_pvgis_hourly( |
193 | 202 | testfile, map_variables=map_variables, pvgis_format=pvgis_format)
|
194 | 203 | # Assert whether dataframe, metadata, and inputs are as expected
|
195 | 204 | assert_frame_equal(out, expected)
|
196 |
| - assert inputs == inputs_exp |
197 | 205 | assert metadata == metadata_exp
|
198 | 206 |
|
199 | 207 |
|
@@ -248,7 +256,7 @@ def test_get_pvgis_hourly(requests_mock, testfile, expected_name, args,
|
248 | 256 | # inputs are passing on correctly
|
249 | 257 | requests_mock.get(url_test, text=mock_response)
|
250 | 258 | # Make API call - an error is raised if requested URI does not match
|
251 |
| - out, inputs, metadata = get_pvgis_hourly( |
| 259 | + out, metadata = get_pvgis_hourly( |
252 | 260 | latitude=45, longitude=8, map_variables=map_variables, **args)
|
253 | 261 | # Get expected dataframe from fixture
|
254 | 262 | expected = request.getfixturevalue(expected_name)
|
|
0 commit comments