@@ -29,6 +29,7 @@ def model_output_data() -> list[dict[str, Any]]:
29
29
Fixture that returns a list of model-output data representing multiple output types.
30
30
This fixture is used as input for other fixtures that generate temporary .csv and .parquest files for testing.
31
31
"""
32
+
32
33
model_output_fieldnames = [
33
34
'reference_date' ,
34
35
'location' ,
@@ -41,8 +42,6 @@ def model_output_data() -> list[dict[str, Any]]:
41
42
model_output_list = [
42
43
['2420-01-01' , 'US' , '1 light year' , 'hospitalizations' , 'quantile' , 0.5 , 62 ],
43
44
['2420-01-01' , 'US' , '1 light year' , 'hospitalizations' , 'quantile' , 0.75 , 50.1 ],
44
- ['2420-01-01' , '02' , 3 , 'hospitalizations' , 'mean' , 'NA' , 11 ],
45
- ['2420-01-01' , '03' , 3 , 'hospitalizations' , 'mean' , 'NA' , 'a string value for some reason' ],
46
45
['2420-01-01' , '03' , 3 , 'hospitalizations' , 'mean' , None , 33 ],
47
46
['1999-12-31' , 'US' , 'last month' , 'hospitalizations' , 'pmf' , 'large_increase' , 2.597827508665773e-9 ],
48
47
]
@@ -203,25 +202,26 @@ def test_added_column_values(model_output_table):
203
202
def test_read_file_csv (test_csv_file , model_output_table ):
204
203
mo = ModelOutputHandler (test_csv_file , 'mock:fake-output-uri' )
205
204
pyarrow_table = mo .read_file ()
206
- assert len (pyarrow_table ) == 6
205
+ assert len (pyarrow_table ) == 4
207
206
208
207
# output_type_id should retain the value from the .csv file, even when the value is empty or "NA"
208
+ # NA values generate
209
209
output_type_id_col = pyarrow_table .column ('output_type_id' )
210
210
assert str (output_type_id_col [0 ]) == '0.5'
211
- assert str (output_type_id_col [2 ]) == 'NA '
212
- assert str (output_type_id_col [4 ]) == ''
211
+ assert str (output_type_id_col [2 ]) == ''
212
+ assert str (output_type_id_col [3 ]) == 'large_increase '
213
213
214
214
215
215
def test_read_file_parquet (test_parquet_file , model_output_table ):
216
216
mo = ModelOutputHandler (test_parquet_file , 'mock:fake-output-uri' )
217
217
pyarrow_table = mo .read_file ()
218
- assert len (pyarrow_table ) == 6
218
+ assert len (pyarrow_table ) == 4
219
219
220
220
# output_type_id should retain the value from the .csv file, even when the value is empty or "NA"
221
221
output_type_id_col = pyarrow_table .column ('output_type_id' )
222
222
assert str (output_type_id_col [0 ]) == '0.5'
223
- assert str (output_type_id_col [2 ]) == 'NA '
224
- assert str (output_type_id_col [4 ]) == ''
223
+ assert str (output_type_id_col [2 ]) == ''
224
+ assert str (output_type_id_col [3 ]) == 'large_increase '
225
225
226
226
227
227
def test_write_parquet (tmpdir , model_output_table ):
@@ -235,7 +235,7 @@ def test_write_parquet(tmpdir, model_output_table):
235
235
assert actual_output_file_path == expected_output_file_path
236
236
237
237
238
- def test_transform_model_output (test_csv_file , tmpdir ):
238
+ def test_transform_model_output_path (test_csv_file , tmpdir ):
239
239
output_dir = str (tmpdir .mkdir ('model-output' ))
240
240
mo = ModelOutputHandler (test_csv_file , output_dir )
241
241
output_uri = mo .transform_model_output ()
0 commit comments