@@ -42,6 +42,7 @@ def test_aggregate_county(self):
42
42
assert np .all (df [f'{ SIGNALS [0 ]} _n' ].values > 0 )
43
43
x = df [f'{ SIGNALS [0 ]} _se' ].values
44
44
assert np .all (x [~ np .isnan (x )] >= 0 )
45
+ assert df .shape == (1472 , 17 )
45
46
46
47
def test_aggregate_state (self ):
47
48
"""Tests that aggregation at the state level creates non-zero-valued
@@ -53,6 +54,31 @@ def test_aggregate_state(self):
53
54
assert np .all (df [f'{ SIGNALS [0 ]} _n' ].values > 0 )
54
55
x = df [f'{ SIGNALS [0 ]} _se' ].values
55
56
assert np .all (x [~ np .isnan (x )] >= 0 )
57
+ assert df .shape == (52 , 17 )
58
+
59
+ def test_aggregate_msa (self ):
60
+ """Tests that aggregation at the state level creates non-zero-valued
61
+ signals."""
62
+ cbg_df = construct_signals (pd .read_csv ('raw_data/sample_raw_data.csv' ),
63
+ SIGNALS )
64
+ df = aggregate (cbg_df , SIGNALS , 'msa' )
65
+
66
+ assert np .all (df [f'{ SIGNALS [0 ]} _n' ].values > 0 )
67
+ x = df [f'{ SIGNALS [0 ]} _se' ].values
68
+ assert np .all (x [~ np .isnan (x )] >= 0 )
69
+ assert df .shape == (372 , 17 )
70
+
71
+ def test_aggregate_hrr (self ):
72
+ """Tests that aggregation at the state level creates non-zero-valued
73
+ signals."""
74
+ cbg_df = construct_signals (pd .read_csv ('raw_data/sample_raw_data.csv' ),
75
+ SIGNALS )
76
+ df = aggregate (cbg_df , SIGNALS , 'hrr' )
77
+
78
+ assert np .all (df [f'{ SIGNALS [0 ]} _n' ].values > 0 )
79
+ x = df [f'{ SIGNALS [0 ]} _se' ].values
80
+ assert np .all (x [~ np .isnan (x )] >= 0 )
81
+ assert df .shape == (306 , 17 )
56
82
57
83
def test_files_in_past_week (self ):
58
84
"""Tests that `files_in_past_week()` finds the file names corresponding
0 commit comments