|
13 | 13 | from delphi.epidata.acquisition.covidcast_nowcast.load_sensors import main, load_and_prepare_file |
14 | 14 |
|
15 | 15 | # py3tester coverage target |
16 | | -__test_target__ = 'delphi.epidata.acquisition.covidcast_nowcast.load_sensors' |
| 16 | +__test_target__ = "delphi.epidata.acquisition.covidcast_nowcast.load_sensors" |
17 | 17 |
|
18 | 18 |
|
19 | 19 | class UpdateTests(unittest.TestCase): |
20 | | - |
21 | | - @mock.patch('time.time', mock.MagicMock(return_value=12345)) |
22 | | - def test_load_and_prepare_file(self): |
23 | | - |
24 | | - test_attributes = PathDetails( |
25 | | - 20210102, |
26 | | - 3, |
27 | | - "test_source", |
28 | | - "test_signal", |
29 | | - "test_time_type", |
30 | | - 20201231, |
31 | | - "test_geo_type", |
32 | | - ) |
33 | | - |
34 | | - test_df = load_and_prepare_file(StringIO("sensor_name,geo_value,value\ntestname,01001,1.5"), test_attributes) |
35 | | - pd.testing.assert_frame_equal(test_df, |
36 | | - pd.DataFrame({"sensor_name": ["testname"], |
37 | | - "geo_value": ["01001"], |
38 | | - "value": [1.5], |
39 | | - "source": ["test_source"], |
40 | | - "signal": ["test_signal"], |
41 | | - "time_type": ["test_time_type"], |
42 | | - "geo_type": ["test_geo_type"], |
43 | | - "time_value": [20201231], |
44 | | - "issue": [20210102], |
45 | | - "lag": [3], |
46 | | - "value_updated_timestamp": [12345]}) |
47 | | - ) |
| 20 | + @mock.patch("time.time", mock.MagicMock(return_value=12345)) |
| 21 | + def test_load_and_prepare_file(self): |
| 22 | + |
| 23 | + test_attributes = PathDetails( |
| 24 | + 20210102, |
| 25 | + 3, |
| 26 | + "test_source", |
| 27 | + "test_signal", |
| 28 | + "test_time_type", |
| 29 | + 20201231, |
| 30 | + "test_geo_type", |
| 31 | + ) |
| 32 | + |
| 33 | + test_df = load_and_prepare_file( |
| 34 | + StringIO("sensor_name,geo_value,value\ntestname,01001,1.5"), test_attributes |
| 35 | + ) |
| 36 | + pd.testing.assert_frame_equal( |
| 37 | + test_df, |
| 38 | + pd.DataFrame( |
| 39 | + { |
| 40 | + "sensor_name": ["testname"], |
| 41 | + "geo_value": ["01001"], |
| 42 | + "value": [1.5], |
| 43 | + "source": ["test_source"], |
| 44 | + "signal": ["test_signal"], |
| 45 | + "time_type": ["test_time_type"], |
| 46 | + "geo_type": ["test_geo_type"], |
| 47 | + "time_value": [20201231], |
| 48 | + "issue": [20210102], |
| 49 | + "lag": [3], |
| 50 | + "value_updated_timestamp": [12345], |
| 51 | + } |
| 52 | + ), |
| 53 | + ) |
0 commit comments