1212# third party
1313import delphi .operations .secrets as secrets
1414from delphi .epidata .acquisition .covidcast .covidcast_meta_cache_updater import main as update_covidcast_meta_cache
15- from delphi .epidata .acquisition .covidcast .covidcast_row import CovidcastRow
16- from delphi .epidata .acquisition .covidcast .test_utils import CovidcastBase
15+ from delphi .epidata .acquisition .covidcast .test_utils import CovidcastBase , CovidcastTestRow
1716from delphi .epidata .client .delphi_epidata import Epidata
1817from delphi_utils import Nans
1918
@@ -52,13 +51,11 @@ def test_covidcast(self):
5251
5352 # insert placeholder data: three issues of one signal, one issue of another
5453 rows = [
55- CovidcastRow .make_default_row (issue = 2020_02_02 + i , value = i , lag = i )
54+ CovidcastTestRow .make_default_row (issue = 2020_02_02 + i , value = i , lag = i )
5655 for i in range (3 )
5756 ]
5857 row_latest_issue = rows [- 1 ]
59- rows .append (
60- CovidcastRow .make_default_row (signal = "sig2" )
61- )
58+ rows .append (CovidcastTestRow .make_default_row (signal = "sig2" ))
6259 self ._insert_rows (rows )
6360
6461 with self .subTest (name = 'request two signals' ):
@@ -68,8 +65,8 @@ def test_covidcast(self):
6865 )
6966
7067 expected = [
71- row_latest_issue .as_dict ( ignore_fields = CovidcastRow . _api_row_compatibility_ignore_fields ),
72- rows [- 1 ].as_dict ( ignore_fields = CovidcastRow . _api_row_compatibility_ignore_fields )
68+ row_latest_issue .as_api_compatibility_row_dict ( ),
69+ rows [- 1 ].as_api_compatibility_row_dict ( )
7370 ]
7471
7572 self .assertEqual (response ['epidata' ], expected )
@@ -88,10 +85,10 @@ def test_covidcast(self):
8885
8986 expected = [{
9087 rows [0 ].signal : [
91- row_latest_issue .as_dict (ignore_fields = CovidcastRow . _api_row_compatibility_ignore_fields + ['signal' ]),
88+ row_latest_issue .as_api_compatibility_row_dict (ignore_fields = ['signal' ]),
9289 ],
9390 rows [- 1 ].signal : [
94- rows [- 1 ].as_dict (ignore_fields = CovidcastRow . _api_row_compatibility_ignore_fields + ['signal' ]),
91+ rows [- 1 ].as_api_compatibility_row_dict (ignore_fields = ['signal' ]),
9592 ],
9693 }]
9794
@@ -108,7 +105,7 @@ def test_covidcast(self):
108105 ** self .params_from_row (rows [0 ])
109106 )
110107
111- expected = [row_latest_issue .as_dict ( ignore_fields = CovidcastRow . _api_row_compatibility_ignore_fields )]
108+ expected = [row_latest_issue .as_api_compatibility_row_dict ( )]
112109
113110 # check result
114111 self .assertEqual (response_1 , {
@@ -123,7 +120,7 @@ def test_covidcast(self):
123120 ** self .params_from_row (rows [0 ], as_of = rows [1 ].issue )
124121 )
125122
126- expected = [rows [1 ].as_dict ( ignore_fields = CovidcastRow . _api_row_compatibility_ignore_fields )]
123+ expected = [rows [1 ].as_api_compatibility_row_dict ( )]
127124
128125 # check result
129126 self .maxDiff = None
@@ -140,8 +137,8 @@ def test_covidcast(self):
140137 )
141138
142139 expected = [
143- rows [0 ].as_dict ( ignore_fields = CovidcastRow . _api_row_compatibility_ignore_fields ),
144- rows [1 ].as_dict ( ignore_fields = CovidcastRow . _api_row_compatibility_ignore_fields )
140+ rows [0 ].as_api_compatibility_row_dict ( ),
141+ rows [1 ].as_api_compatibility_row_dict ( )
145142 ]
146143
147144 # check result
@@ -157,7 +154,7 @@ def test_covidcast(self):
157154 ** self .params_from_row (rows [0 ], lag = 2 )
158155 )
159156
160- expected = [row_latest_issue .as_dict ( ignore_fields = CovidcastRow . _api_row_compatibility_ignore_fields )]
157+ expected = [row_latest_issue .as_api_compatibility_row_dict ( )]
161158
162159 # check result
163160 self .assertDictEqual (response_3 , {
@@ -222,16 +219,16 @@ def test_geo_value(self):
222219 # insert placeholder data: three counties, three MSAs
223220 N = 3
224221 rows = [
225- CovidcastRow .make_default_row (geo_type = "county" , geo_value = str (i )* 5 , value = i )
222+ CovidcastTestRow .make_default_row (geo_type = "county" , geo_value = str (i )* 5 , value = i )
226223 for i in range (N )
227224 ] + [
228- CovidcastRow .make_default_row (geo_type = "msa" , geo_value = str (i )* 5 , value = i * 10 )
225+ CovidcastTestRow .make_default_row (geo_type = "msa" , geo_value = str (i )* 5 , value = i * 10 )
229226 for i in range (N )
230227 ]
231228 self ._insert_rows (rows )
232229
233230 counties = [
234- rows [i ].as_dict ( ignore_fields = CovidcastRow . _api_row_compatibility_ignore_fields ) for i in range (N )
231+ rows [i ].as_api_compatibility_row_dict ( ) for i in range (N )
235232 ]
236233
237234 def fetch (geo ):
@@ -277,7 +274,11 @@ def test_covidcast_meta(self):
277274 # 2nd issue: 1 11 21
278275 # 3rd issue: 2 12 22
279276 rows = [
280- CovidcastRow .make_default_row (time_value = DEFAULT_TIME_VALUE + t , issue = DEFAULT_ISSUE + i , value = t * 10 + i )
277+ CovidcastTestRow .make_default_row (
278+ time_value = DEFAULT_TIME_VALUE + t ,
279+ issue = DEFAULT_ISSUE + i ,
280+ value = t * 10 + i
281+ )
281282 for i in range (3 ) for t in range (3 )
282283 ]
283284 self ._insert_rows (rows )
@@ -324,10 +325,10 @@ def test_async_epidata(self):
324325 # insert placeholder data: three counties, three MSAs
325326 N = 3
326327 rows = [
327- CovidcastRow .make_default_row (geo_type = "county" , geo_value = str (i )* 5 , value = i )
328+ CovidcastTestRow .make_default_row (geo_type = "county" , geo_value = str (i )* 5 , value = i )
328329 for i in range (N )
329330 ] + [
330- CovidcastRow .make_default_row (geo_type = "msa" , geo_value = str (i )* 5 , value = i * 10 )
331+ CovidcastTestRow .make_default_row (geo_type = "msa" , geo_value = str (i )* 5 , value = i * 10 )
331332 for i in range (N )
332333 ]
333334 self ._insert_rows (rows )
0 commit comments