1
+ import numpy as np
1
2
import os
2
3
from epidatpy .request import Epidata , EpiRange
3
4
@@ -22,6 +23,7 @@ def test_pvt_cdc() -> None:
22
23
)
23
24
data = apicall .df ()
24
25
assert len (data ) > 0
26
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
25
27
26
28
def test_pub_covid_hosp_facility_lookup () -> None :
27
29
apicall = Epidata .pub_covid_hosp_facility_lookup (state = "fl" )
@@ -51,6 +53,8 @@ def test_pub_covid_hosp_state_timeseries() -> None:
51
53
dates = EpiRange (20200101 , 20200501 ))
52
54
data = apicall .df ()
53
55
assert len (data ) > 0
56
+ assert str (data ['issue' ].dtype ) == 'datetime64[ns]'
57
+ assert str (data ['date' ].dtype ) == 'datetime64[ns]'
54
58
55
59
def test_pub_covidcast_meta () -> None :
56
60
apicall = Epidata .pub_covidcast_meta ()
@@ -76,6 +80,8 @@ def test_pub_covidcast() -> None:
76
80
geo_values = "*" ,
77
81
time_values = EpiRange (20200601 , 20200801 ))
78
82
data = apicall .df ()
83
+ assert str (data ['time_value' ].dtype ) == 'datetime64[ns]'
84
+ assert str (data ['issue' ].dtype ) == 'datetime64[ns]'
79
85
assert len (data ) > 0
80
86
81
87
def test_pub_delphi () -> None :
@@ -93,6 +99,7 @@ def test_pub_dengue_nowcast() -> None:
93
99
)
94
100
data = apicall .df ()
95
101
assert len (data ) > 0
102
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
96
103
97
104
def test_pvt_dengue_sensors () -> None :
98
105
apicall = Epidata .pvt_dengue_sensors (
@@ -103,43 +110,57 @@ def test_pvt_dengue_sensors() -> None:
103
110
)
104
111
data = apicall .df ()
105
112
assert len (data ) > 0
113
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
106
114
107
115
def test_pub_ecdc_ili () -> None :
108
116
apicall = Epidata .pub_ecdc_ili (
109
117
regions = "austria" ,
110
118
epiweeks = EpiRange (201901 , 202001 )
111
119
)
112
- data = apicall .df (disable_date_parsing = True )
120
+ data = apicall .df ()
113
121
assert len (data ) > 0
122
+ assert str (data ['release_date' ].dtype ) == 'datetime64[ns]'
123
+ assert str (data ['issue' ].dtype ) == 'datetime64[ns]'
124
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
114
125
115
126
def test_pub_flusurv () -> None :
116
127
apicall = Epidata .pub_flusurv (
117
128
locations = "CA" ,
118
129
epiweeks = EpiRange (201701 , 201801 )
119
130
)
120
- data = apicall .df (disable_date_parsing = True )
131
+ data = apicall .df ()
121
132
assert len (data ) > 0
133
+ assert str (data ['issue' ].dtype ) == 'datetime64[ns]'
134
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
122
135
123
136
def test_pub_fluview_clinical () -> None :
124
137
apicall = Epidata .pub_fluview_clinical (
125
138
regions = "nat" ,
126
139
epiweeks = EpiRange (201601 , 201701 )
127
140
)
128
- data = apicall .df (disable_date_parsing = True )
141
+ data = apicall .df ()
129
142
assert len (data ) > 0
143
+ assert str (data ['release_date' ].dtype ) == 'datetime64[ns]'
144
+ assert str (data ['issue' ].dtype ) == 'datetime64[ns]'
145
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
130
146
131
147
def test_pub_fluview_meta () -> None :
132
148
apicall = Epidata .pub_fluview_meta ()
133
- data = apicall .df (disable_date_parsing = True )
149
+ data = apicall .df ()
134
150
assert len (data ) > 0
151
+ assert str (data ['latest_update' ].dtype ) == 'datetime64[ns]'
152
+ assert str (data ['latest_issue' ].dtype ) == 'datetime64[ns]'
135
153
136
154
def test_pub_fluview () -> None :
137
155
apicall = Epidata .pub_fluview (
138
156
regions = "nat" ,
139
157
epiweeks = EpiRange (201201 , 202005 )
140
158
)
141
- data = apicall .df (disable_date_parsing = True )
159
+ data = apicall .df ()
142
160
assert len (data ) > 0
161
+ assert str (data ['release_date' ].dtype ) == 'datetime64[ns]'
162
+ assert str (data ['issue' ].dtype ) == 'datetime64[ns]'
163
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
143
164
144
165
def test_pub_gft () -> None :
145
166
apicall = Epidata .pub_gft (
@@ -148,6 +169,7 @@ def test_pub_gft() -> None:
148
169
)
149
170
data = apicall .df ()
150
171
assert len (data ) > 0
172
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
151
173
152
174
def test_pvt_ght () -> None :
153
175
apicall = Epidata .pvt_ght (
@@ -158,14 +180,18 @@ def test_pvt_ght() -> None:
158
180
)
159
181
data = apicall .df ()
160
182
assert len (data ) > 0
183
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
161
184
162
185
def test_pub_kcdc_ili () -> None :
163
186
apicall = Epidata .pub_kcdc_ili (
164
187
regions = "ROK" ,
165
188
epiweeks = 200436
166
189
)
167
- data = apicall .df (disable_date_parsing = True )
190
+ data = apicall .df ()
168
191
assert len (data ) > 0
192
+ assert str (data ['release_date' ].dtype ) == 'datetime64[ns]'
193
+ assert str (data ['issue' ].dtype ) == 'datetime64[ns]'
194
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
169
195
170
196
def test_pvt_meta_norostat () -> None :
171
197
apicall = Epidata .pvt_meta_norostat (
@@ -186,14 +212,18 @@ def test_pub_nidss_dengue() -> None:
186
212
)
187
213
data = apicall .df ()
188
214
assert len (data ) > 0
215
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
189
216
190
217
def test_pub_nidss_flu () -> None :
191
218
apicall = Epidata .pub_nidss_flu (
192
219
regions = "taipei" ,
193
220
epiweeks = EpiRange (201501 , 201601 )
194
221
)
195
- data = apicall .df (disable_date_parsing = True )
222
+ data = apicall .df ()
196
223
assert len (data ) > 0
224
+ assert str (data ['release_date' ].dtype ) == 'datetime64[ns]'
225
+ assert str (data ['issue' ].dtype ) == 'datetime64[ns]'
226
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
197
227
198
228
def test_pvt_norostat () -> None :
199
229
apicall = Epidata .pvt_norostat (
@@ -204,6 +234,8 @@ def test_pvt_norostat() -> None:
204
234
data = apicall .df ()
205
235
# TODO: Norostat is known to not return data
206
236
# assert len(data) > 0
237
+ # assert str(data['release_date'].dtype) == 'datetime64[ns]'
238
+ # assert str(data['epiweek'].dtype) == 'datetime64[ns]'
207
239
208
240
def test_pub_nowcast () -> None :
209
241
apicall = Epidata .pub_nowcast (
@@ -212,14 +244,18 @@ def test_pub_nowcast() -> None:
212
244
)
213
245
data = apicall .df ()
214
246
assert len (data ) > 0
247
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
215
248
216
249
def test_pub_paho_dengue () -> None :
217
250
apicall = Epidata .pub_paho_dengue (
218
251
regions = "ca" ,
219
252
epiweeks = EpiRange (201401 , 201501 )
220
253
)
221
- data = apicall .df (disable_date_parsing = True )
254
+ data = apicall .df ()
222
255
assert len (data ) > 0
256
+ assert str (data ['release_date' ].dtype ) == 'datetime64[ns]'
257
+ assert str (data ['issue' ].dtype ) == 'datetime64[ns]'
258
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
223
259
224
260
def test_pvt_quidel () -> None :
225
261
apicall = Epidata .pvt_quidel (
@@ -229,6 +265,7 @@ def test_pvt_quidel() -> None:
229
265
)
230
266
data = apicall .df ()
231
267
assert len (data ) > 0
268
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
232
269
233
270
def test_pvt_sensors () -> None :
234
271
apicall = Epidata .pvt_sensors (
@@ -239,6 +276,7 @@ def test_pvt_sensors() -> None:
239
276
)
240
277
data = apicall .df ()
241
278
assert len (data ) > 0
279
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
242
280
243
281
def test_pvt_twitter () -> None :
244
282
apicall = Epidata .pvt_twitter (
@@ -249,6 +287,7 @@ def test_pvt_twitter() -> None:
249
287
)
250
288
data = apicall .df ()
251
289
assert len (data ) > 0
290
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
252
291
253
292
def test_pub_wiki () -> None :
254
293
apicall = Epidata .pub_wiki (
@@ -258,3 +297,4 @@ def test_pub_wiki() -> None:
258
297
)
259
298
data = apicall .df ()
260
299
assert len (data ) > 0
300
+ assert str (data ['epiweek' ].dtype ) == 'datetime64[ns]'
0 commit comments