Skip to content

Commit 4b34006

Browse files
committed
Update tests
1 parent 934724a commit 4b34006

File tree

2 files changed

+17
-155
lines changed

2 files changed

+17
-155
lines changed
Lines changed: 5 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -1,150 +1,5 @@
1-
countyFIPS,County Name,State,stateFIPS,2/29/20,3/1/20,3/2/20,3/3/20,3/4/20,3/5/20,3/6/20,3/7/20,3/8/20,3/9/20,3/10/20
2-
1041,Crenshaw County,AL,1,0,0,0,0,0,0,0,0,0,0,0
3-
1067,Henry County,AL,1,0,0,0,0,0,0,0,0,0,0,0
4-
2158,Kusilvak Census Area,AK,2,0,0,0,0,0,0,0,0,0,0,0
5-
2270,Wade Hampton Census Area,AK,2,0,0,0,0,0,0,0,0,0,0,0
6-
5043,Drew County,AR,5,0,0,0,0,0,0,0,0,0,0,0
7-
5053,Grant County,AR,5,0,0,0,0,0,0,0,0,0,0,0
8-
5075,Lawrence County,AR,5,0,0,0,0,0,0,0,0,0,0,0
9-
5077,Lee County,AR,5,0,0,0,0,0,0,0,0,0,0,0
10-
5085,Lonoke County,AR,5,0,0,0,0,0,0,0,0,0,0,0
11-
5119,Pulaski County,AR,5,0,0,0,0,0,0,0,0,0,0,0
12-
6051,Mono County,CA,6,0,0,0,0,0,0,0,0,0,0,0
13-
6071,San Bernardino County,CA,6,0,0,0,0,0,0,0,0,0,0,0
14-
8014,Broomfield County,CO,8,0,0,0,0,0,0,0,0,0,0,0
15-
8015,Chaffee County,CO,8,0,0,0,0,0,0,0,0,0,0,0
16-
9011,New London County,CT,9,0,0,0,0,0,0,0,0,0,0,0
17-
12073,Leon County,FL,12,0,0,0,0,0,0,0,0,0,0,0
18-
12127,Volusia County,FL,12,0,0,0,0,0,0,0,0,0,0,0
19-
13043,Candler County,GA,13,0,0,0,0,0,0,0,0,0,0,0
20-
13167,Johnson County,GA,13,0,0,0,0,0,0,0,0,0,0,0
21-
13211,Morgan County,GA,13,0,0,0,0,0,0,0,0,0,0,0
22-
13289,Twiggs County,GA,13,0,0,0,0,0,0,0,0,0,0,0
23-
13295,Walker County,GA,13,0,0,0,0,0,0,0,0,0,0,0
24-
13303,Washington County,GA,13,0,0,0,0,0,0,0,0,0,0,0
25-
16033,Clark County,ID,16,0,0,0,0,0,0,0,0,0,0,0
26-
17043,DuPage County,IL,17,0,0,0,0,0,0,0,0,0,0,0
27-
17091,Kankakee County,IL,17,0,0,0,0,0,0,0,0,0,0,0
28-
17129,Menard County,IL,17,0,0,0,0,0,0,0,0,0,0,0
29-
18055,Greene County,IN,18,0,0,0,0,0,0,0,0,0,0,0
30-
19047,Crawford County,IA,19,0,0,0,0,0,0,0,0,0,0,0
31-
19063,Emmet County,IA,19,0,0,0,0,0,0,0,0,0,0,0
32-
19159,Ringgold County,IA,19,0,0,0,0,0,0,0,0,0,0,0
33-
20053,Ellsworth County,KS,20,0,0,0,0,0,0,0,0,0,0,0
34-
20179,Sheridan County,KS,20,0,0,0,0,0,0,0,0,0,0,0
35-
21037,Campbell County,KY,21,0,0,0,0,0,0,0,0,0,0,0
36-
21045,Casey County,KY,21,0,0,0,0,0,0,0,0,0,0,0
37-
21101,Henderson County,KY,21,0,0,0,0,0,0,0,0,0,0,0
38-
21171,Monroe County,KY,21,0,0,0,0,0,0,0,0,0,0,0
39-
21207,Russell County,KY,21,0,0,0,0,0,0,0,0,0,0,0
40-
21211,Shelby County,KY,21,0,0,0,0,0,0,0,0,0,0,0
41-
22023,Cameron Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0
42-
22073,Ouachita Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0
43-
22079,Rapides Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0
44-
22081,Red River Parish,LA,22,0,0,0,0,0,0,0,0,0,0,0
45-
24023,Garrett County,MD,24,0,0,0,0,0,0,0,0,0,0,0
46-
25025,Suffolk County,MA,25,0,0,0,0,0,0,0,0,0,0,0
47-
26047,Emmet County,MI,26,0,0,0,0,0,0,0,0,0,0,0
48-
26069,Iosco County,MI,26,0,0,0,0,0,0,0,0,0,0,0
49-
27025,Chisago County,MN,27,0,0,0,0,0,0,0,0,0,0,0
50-
28001,Adams County,MS,28,0,0,0,0,0,0,0,0,0,0,0
51-
28005,Amite County,MS,28,0,0,0,0,0,0,0,0,0,0,0
52-
28039,George County,MS,28,0,0,0,0,0,0,0,0,0,0,0
53-
28041,Greene County,MS,28,0,0,0,0,0,0,0,0,0,0,0
54-
28045,Hancock County,MS,28,0,0,0,0,0,0,0,0,0,0,0
55-
28047,Harrison County,MS,28,0,0,0,0,0,0,0,0,0,0,0
56-
28051,Holmes County,MS,28,0,0,0,0,0,0,0,0,0,0,0
57-
28059,Jackson County,MS,28,0,0,0,0,0,0,0,0,0,0,0
58-
28107,Panola County,MS,28,0,0,0,0,0,0,0,0,0,0,0
59-
28109,Pearl River County,MS,28,0,0,0,0,0,0,0,0,0,0,0
60-
28131,Stone County,MS,28,0,0,0,0,0,0,0,0,0,0,0
61-
29011,Barton County,MO,29,0,0,0,0,0,0,0,0,0,0,0
62-
29057,Dade County,MO,29,0,0,0,0,0,0,0,0,0,0,0
63-
29125,Maries County,MO,29,0,0,0,0,0,0,0,0,0,0,0
64-
29213,Taney County,MO,29,0,0,0,0,0,0,0,0,0,0,0
65-
30095,Stillwater County,MT,30,0,0,0,0,0,0,0,0,0,0,0
66-
31029,Chase County,NE,31,0,0,0,0,0,0,0,0,0,0,0
67-
31057,Dundy County,NE,31,0,0,0,0,0,0,0,0,0,0,0
68-
31105,Kimball County,NE,31,0,0,0,0,0,0,0,0,0,0,0
69-
31115,Loup County,NE,31,0,0,0,0,0,0,0,0,0,0,0
70-
31165,Sioux County,NE,31,0,0,0,0,0,0,0,0,0,0,0
71-
32001,Churchill County,NV,32,0,0,0,0,0,0,0,0,0,0,0
72-
32510,Carson City,NV,32,0,0,0,0,0,0,0,0,0,0,0
73-
33003,Carroll County,NH,33,0,0,0,0,0,0,0,0,0,0,0
74-
35045,San Juan County,NM,35,0,0,0,0,0,0,0,0,0,0,0
75-
1,New York City Unallocated/Probable,NY,36,0,0,0,0,0,0,0,0,0,0,0
76-
36005,Bronx County,NY,36,0,0,0,0,0,0,0,0,0,0,0
77-
36009,Cattaraugus County,NY,36,0,0,0,0,0,0,0,0,0,0,0
78-
36035,Fulton County,NY,36,0,0,0,0,0,0,0,0,0,0,0
79-
36047,Kings County,NY,36,0,0,0,0,0,0,0,0,0,0,0
80-
36061,New York County,NY,36,0,0,0,0,0,0,0,0,0,0,0
81-
36081,Queens County,NY,36,0,0,0,0,0,0,0,0,0,0,0
82-
36085,Richmond County,NY,36,0,0,0,0,0,0,0,0,0,0,0
83-
36093,Schenectady County,NY,36,0,0,0,0,0,0,0,0,0,0,0
84-
37135,Orange County,NC,37,0,0,0,0,0,0,0,0,0,0,0
85-
38019,Cavalier County,ND,38,0,0,0,0,0,0,0,0,0,0,0
86-
38031,Foster County,ND,38,0,0,0,0,0,0,0,0,0,0,0
87-
39075,Holmes County,OH,39,0,0,0,0,0,0,0,0,0,0,0
88-
40045,Ellis County,OK,40,0,0,0,0,0,0,0,0,0,0,0
89-
40059,Harper County,OK,40,0,0,0,0,0,0,0,0,0,0,0
90-
40061,Haskell County,OK,40,0,0,0,0,0,0,0,0,0,0,0
91-
40079,Le Flore County,OK,40,0,0,0,0,0,0,0,0,0,0,0
92-
41013,Crook County,OR,41,0,0,0,0,0,0,0,0,0,0,0
93-
41015,Curry County,OR,41,0,0,0,0,0,0,0,0,0,0,0
94-
41045,Malheur County,OR,41,0,0,0,0,0,0,0,0,0,0,0
95-
46021,Campbell County,SD,46,0,0,0,0,0,0,0,0,0,0,0
96-
46063,Harding County,SD,46,0,0,0,0,0,0,0,0,0,0,0
97-
46102,Oglala Lakota County,SD,46,0,0,0,0,0,0,0,0,0,0,0
98-
47031,Coffee County,TN,47,0,0,0,0,0,0,0,0,0,0,0
99-
47077,Henderson County,TN,47,0,0,0,0,0,0,0,0,0,0,0
100-
47099,Lawrence County,TN,47,0,0,0,0,0,0,0,0,0,0,0
101-
47113,Madison County,TN,47,0,0,0,0,0,0,0,0,0,0,0
102-
47177,Warren County,TN,47,0,0,0,0,0,0,0,0,0,0,0
103-
47187,Williamson County,TN,47,0,0,0,0,0,0,0,0,0,0,0
104-
48021,Bastrop County,TX,48,0,0,0,0,0,0,0,0,0,0,0
105-
48059,Callahan County,TX,48,0,0,0,0,0,0,0,0,0,0,0
106-
48061,Cameron County,TX,48,0,0,0,0,0,0,0,0,0,0,0
107-
48143,Erath County,TX,48,0,0,0,0,0,0,0,0,0,0,0
108-
48151,Fisher County,TX,48,0,0,0,0,0,0,0,0,0,0,0
109-
48173,Glasscock County,TX,48,0,0,0,0,0,0,0,0,0,0,0
110-
48263,Kent County,TX,48,0,0,0,0,0,0,0,0,0,0,0
111-
48303,Lubbock County,TX,48,0,0,0,0,0,0,0,0,0,0,0
112-
48365,Panola County,TX,48,0,0,0,0,0,0,0,0,0,0,0
113-
48411,San Saba County,TX,48,0,0,0,0,0,0,0,0,0,0,0
114-
48425,Somervell County,TX,48,0,0,0,0,0,0,0,0,0,0,0
115-
48449,Titus County,TX,48,0,0,0,0,0,0,0,0,0,0,0
116-
48495,Winkler County,TX,48,0,0,0,0,0,0,0,0,0,0,0
117-
50005,Caledonia County,VT,50,0,0,0,0,0,0,0,0,0,0,0
118-
50027,Windsor County,VT,50,0,0,0,0,0,0,0,0,0,0,0
119-
51005,Alleghany County,VA,51,0,0,0,0,0,0,0,0,0,0,0
120-
51015,Augusta County,VA,51,0,0,0,0,0,0,0,0,0,0,0
121-
51025,Brunswick County,VA,51,0,0,0,0,0,0,0,0,0,0,0
122-
51043,Clarke County,VA,51,0,0,0,0,0,0,0,0,0,0,0
123-
51059,Fairfax County,VA,51,0,0,0,0,0,0,0,0,0,0,0
124-
51067,Franklin County,VA,51,0,0,0,0,0,0,0,0,0,0,0
125-
51081,Greensville County,VA,51,0,0,0,0,0,0,0,0,0,0,0
126-
51089,Henry County,VA,51,0,0,0,0,0,0,0,0,0,0,0
127-
51093,Isle of Wight County,VA,51,0,0,0,0,0,0,0,0,0,0,0
128-
51131,Northampton County,VA,51,0,0,0,0,0,0,0,0,0,0,0
129-
51153,Prince William County,VA,51,0,0,0,0,0,0,0,0,0,0,0
130-
51163,Rockbridge County,VA,51,0,0,0,0,0,0,0,0,0,0,0
131-
51175,Southampton County,VA,51,0,0,0,0,0,0,0,0,0,0,0
132-
51183,Sussex County,VA,51,0,0,0,0,0,0,0,0,0,0,0
133-
51195,Wise County,VA,51,0,0,0,0,0,0,0,0,0,0,0
134-
51520,Bristol city,VA,51,0,0,0,0,0,0,0,0,0,0,0
135-
51540,Charlottesville city,VA,51,0,0,0,0,0,0,0,0,0,0,0
136-
51580,Covington city,VA,51,0,0,0,0,0,0,0,0,0,0,0
137-
51595,Emporia city,VA,51,0,0,0,0,0,0,0,0,0,0,0
138-
51600,Fairfax city,VA,51,0,0,0,0,0,0,0,0,0,0,0
139-
51620,Franklin city,VA,51,0,0,0,0,0,0,0,0,0,0,0
140-
51678,Lexington city,VA,51,0,0,0,0,0,0,0,0,0,0,0
141-
51685,Manassas Park city,VA,51,0,0,0,0,0,0,0,0,0,0,0
142-
51690,Martinsville city,VA,51,0,0,0,0,0,0,0,0,0,0,0
143-
53063,Spokane County,WA,53,0,0,0,0,0,0,0,0,0,0,0
144-
54015,Clay County,WV,54,0,0,0,0,0,0,0,0,0,0,0
145-
54033,Harrison County,WV,54,0,0,0,0,0,0,0,0,0,0,0
146-
54087,Roane County,WV,54,0,0,0,0,0,0,0,0,0,0,0
147-
55009,Brown County,WI,55,0,0,0,0,0,0,0,0,0,0,0
148-
55071,Manitowoc County,WI,55,0,0,0,0,0,0,0,0,0,0,0
149-
55107,Rusk County,WI,55,0,0,0,0,0,0,0,0,0,0,0
150-
55115,Shawano County,WI,55,0,0,0,0,0,0,0,0,0,0,0
1+
countyFIPS,County Name,State,stateFIPS,2/29/20,3/1/20,3/2/20
2+
1,New York City Unallocated/Probable,NY,36,0,0,1
3+
6000,Somewhere,NY,36,11,12,13
4+
2270,Place,NY,36,101,101,"1,0,2"
5+
36009,City,NY,36,2,4,6

usafacts/tests/test_pull.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from os.path import join
44

55
import pandas as pd
6+
import numpy as np
67
from delphi_utils import GeoMapper
78
from delphi_usafacts.pull import pull_usafacts_data
89

@@ -21,11 +22,17 @@ class TestPullUSAFacts:
2122
def test_good_file(self):
2223
metric = "deaths"
2324
df = pull_usafacts_data(base_url_good, metric, geo_mapper)
24-
25-
assert (
26-
df.columns.values
27-
== ["fips", "timestamp", "population", "new_counts", "cumulative_counts"]
28-
).all()
25+
expected_df = pd.DataFrame({
26+
"fips": ["00001", "00001", "00001", "36009", "36009", "36009"],
27+
"timestamp": [pd.Timestamp("2020-02-29"), pd.Timestamp("2020-03-01"),
28+
pd.Timestamp("2020-03-02"), pd.Timestamp("2020-02-29"),
29+
pd.Timestamp("2020-03-01"), pd.Timestamp("2020-03-02")],
30+
"population": [np.nan, np.nan, np.nan, 76117., 76117., 76117.],
31+
"new_counts": [0., 0., 1., 2., 2., 2.],
32+
"cumulative_counts": [0, 0, 1, 2, 4, 6]},
33+
index=[1, 2, 3, 5, 6, 7])
34+
# sort since rows order doesn't matter
35+
pd.testing.assert_frame_equal(df.sort_index(), expected_df.sort_index())
2936

3037
def test_missing_days(self):
3138

0 commit comments

Comments
 (0)