def test_get_cummulative_deaths(self): country = Country("TEST") with open("./tests/data/australiadata.json", "r") as filehandler: country.data = json.loads(filehandler.readline()) country.get_cumulative_deaths() self.assertEqual(country.cumulative_deaths, [1, 1, 2, 2, 2])
def test_get_cummulative_cases(self): country = Country("TEST") with open("./tests/data/australiadata.json", "r") as filehandler: country.data = json.loads(filehandler.readline()) country.get_cumulative_cases() self.assertEqual(country.cumulative_cases, [30, 39, 52, 55, 60])
def test_get_daily_deaths(self): country = Country("TEST") with open("./tests/data/australiadata.json", "r") as filehandler: country.data = json.loads(filehandler.readline()) country.get_daily_deaths() self.assertEqual(country.daily_deaths, [0, 1, 0, 0])
def test_get_fourteen_day_average(self): country = Country("TEST") with open("./tests/data/fourteen_day_average_australia_data.json", "r") as filehandler: country.data = json.loads(filehandler.readline()) country.get_daily_cases() country.get_fourteen_day_average_cases() self.assertEqual( country.fourteen_day_average_cases, [7, 9, 7, 6, 10, 11, 11, 12, 13, 14, 13, 16, 15, 16, 17, 19, 21])
def test_get_case_fatality_rate(self): country = Country("TEST") with open("./tests/data/australiadata.json", "r") as filehandler: country.data = json.loads(filehandler.readline()) country.get_cumulative_cases() country.get_cumulative_deaths() country.get_case_fatality_rate() self.assertEqual(country.case_fatality_rate, [ 1 / 30 * 100, 1 / 39 * 100, 2 / 52 * 100, 2 / 55 * 100, 2 / 60 * 100 ])