Skip to content

Commit f6d8fc2

Browse files
committed
Update tests
1 parent ea32056 commit f6d8fc2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

safegraph/tests/test_process.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def test_aggregate_county(self):
4242
assert np.all(df[f'{SIGNALS[0]}_n'].values > 0)
4343
x = df[f'{SIGNALS[0]}_se'].values
4444
assert np.all(x[~np.isnan(x)] >= 0)
45+
assert df.shape == (1472, 17)
4546

4647
def test_aggregate_state(self):
4748
"""Tests that aggregation at the state level creates non-zero-valued
@@ -53,6 +54,31 @@ def test_aggregate_state(self):
5354
assert np.all(df[f'{SIGNALS[0]}_n'].values > 0)
5455
x = df[f'{SIGNALS[0]}_se'].values
5556
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)
5682

5783
def test_files_in_past_week(self):
5884
"""Tests that `files_in_past_week()` finds the file names corresponding

0 commit comments

Comments
 (0)