4
4
import pandas as pd
5
5
6
6
from delphi_nchs_mortality .export import export_csv
7
+ from delphi_utils import Nans
7
8
8
9
9
10
class TestExport :
@@ -16,7 +17,10 @@ def test_export(self):
16
17
"val" : [0 , 2 , 3 , 5 , 10 , 12 ],
17
18
"timestamp" : [datetime (2020 , 6 , 2 ), datetime (2020 , 6 , 9 )] * 3 ,
18
19
"se" : [0.01 , 0.02 , 0.01 , 0.01 , 0.005 , 0.01 ],
19
- "sample_size" : [100 , 200 , 500 , 50 , 80 , 10 ]
20
+ "sample_size" : [100 , 200 , 500 , 50 , 80 , 10 ],
21
+ "missing_val" : [Nans .NOT_MISSING ] * 6 ,
22
+ "missing_se" : [Nans .NOT_MISSING ] * 6 ,
23
+ "missing_sample_size" : [Nans .NOT_MISSING ] * 6 ,
20
24
}
21
25
)
22
26
@@ -34,7 +38,11 @@ def test_export(self):
34
38
35
39
output_data = pd .read_csv (join ("./receiving" , expected_name ))
36
40
37
- assert (output_data .columns == ["geo_id" , "val" , "se" , "sample_size" ]).all ()
41
+ expected_columns = [
42
+ "geo_id" , "val" , "se" , "sample_size" ,
43
+ "missing_val" , "missing_se" , "missing_sample_size"
44
+ ]
45
+ assert (output_data .columns == expected_columns ).all ()
38
46
assert (output_data .geo_id == ["a" , "b" , "c" ]).all ()
39
47
assert (output_data .se .values == [0.01 , 0.01 , 0.005 ]).all ()
40
48
assert (output_data .sample_size .values == [100 , 500 , 80 ]).all ()
@@ -45,7 +53,7 @@ def test_export(self):
45
53
46
54
output_data = pd .read_csv (join ("./receiving" , expected_name ))
47
55
48
- assert (output_data .columns == [ "geo_id" , "val" , "se" , "sample_size" ] ).all ()
56
+ assert (output_data .columns == expected_columns ).all ()
49
57
assert (output_data .geo_id == ["a" , "b" , "c" ]).all ()
50
58
assert (output_data .se .values == [0.02 , 0.01 , 0.01 ]).all ()
51
59
assert (output_data .sample_size .values == [200 , 50 , 10 ]).all ()
0 commit comments