@@ -6,7 +6,7 @@ def mocked_timeline(*args, **kwargs):
66 class TestTimeline :
77 def __init__ (self , latest ):
88 self .latest = latest
9-
9+
1010 return TestTimeline (args [0 ])
1111
1212@pytest .mark .parametrize ("test_id, country, country_code, province, latitude, longitude, \
@@ -19,25 +19,37 @@ def test_location_class(mocked_timeline, test_id, country, country_code, provinc
1919 longitude , confirmed_latest , deaths_latest , recovered_latest ):
2020
2121 # id, country, province, coordinates, confirmed, deaths, recovered
22- coordinate = coordinates .Coordinates (latitude = latitude , longitude = longitude )
22+ coordinates = coordinates .Coordinates (latitude = latitude , longitude = longitude )
23+
24+ # Timelines
2325 confirmed = timeline .Timeline (confirmed_latest )
2426 deaths = timeline .Timeline (deaths_latest )
2527 recovered = timeline .Timeline (recovered_latest )
2628
27- location_obj = location .Location (test_id , country , province , coordinate ,
28- confirmed , deaths , recovered )
29+ # Location
30+ location = location .TimelinedLocation (test_id , country , province , coordinates , {
31+ 'confirmed' : confirmed ,
32+ 'deaths' : deaths ,
33+ 'recovered' : recovered ,
34+ })
2935
30- assert location_obj .country_code == country_code
36+ assert location .country_code == country_code
3137
3238 #validate serialize
33- check_dict = {'id' : test_id ,
34- 'country' : country ,
35- 'province' : province ,
36- 'country_code' : country_code ,
37- 'coordinates' : {'latitude' : latitude ,
38- 'longitude' : longitude },
39- 'latest' : {'confirmed' : confirmed_latest ,
40- 'deaths' : deaths_latest ,
41- 'recovered' : recovered_latest }}
42-
43- assert location_obj .serialize () == check_dict
39+ check_dict = {
40+ 'id' : test_id ,
41+ 'country' : country ,
42+ 'country_code' : country_code ,
43+ 'province' : province ,
44+ 'coordinates' : {
45+ 'latitude' : latitude ,
46+ 'longitude' : longitude
47+ },
48+ 'latest' : {
49+ 'confirmed' : confirmed_latest ,
50+ 'deaths' : deaths_latest ,
51+ 'recovered' : recovered_latest
52+ }
53+ }
54+
55+ assert location .serialize () == check_dict
0 commit comments