From 32a81702b87a2acb82eda27ed5032e46709a3e45 Mon Sep 17 00:00:00 2001 From: Ahmed Nafies Date: Sun, 30 May 2021 10:39:45 +0200 Subject: [PATCH] adds new fields --- covid/worldometers/models.py | 3 ++- tests/test_worldometer.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/covid/worldometers/models.py b/covid/worldometers/models.py index 02f5aaf..1e85cac 100644 --- a/covid/worldometers/models.py +++ b/covid/worldometers/models.py @@ -11,14 +11,15 @@ class CovidModel(BaseModel): """Dataclass acts as a Model for Covid data""" country: str = Field(..., alias="Country,Other") + total_cases: int = Field(0, alias="TotalCases") confirmed: int = Field(0, alias="TotalCases") new_cases: int = Field(0, alias="NewCases") deaths: int = Field(0, alias="TotalDeaths") new_deaths: int = Field(0, alias="NewDeaths") recovered: int = Field(0, alias="TotalRecovered") active: int = Field(0, alias="ActiveCases") + active_cases: int = Field(0, alias="ActiveCases") critical: int = Field(0, alias="Serious,Critical") - new_deaths: int = Field(0, alias="NewDeaths") total_tests: int = Field(0, alias="TotalTests") total_tests_per_million: Decimal = Field(Decimal(0), alias="Tests/1M pop") total_cases_per_million: Decimal = Field( diff --git a/tests/test_worldometer.py b/tests/test_worldometer.py index 7d03a5c..61f7632 100644 --- a/tests/test_worldometer.py +++ b/tests/test_worldometer.py @@ -15,7 +15,9 @@ def test_all_data(): element = data[0] assert "country" in element assert "confirmed" in element + assert "total_cases" in element assert "active" in element + assert "active_cases" in element assert "deaths" in element assert "recovered" in element assert "new_cases" in element @@ -34,7 +36,9 @@ def test_get_by_country_name(): assert type(element) is dict assert "country" in element assert "confirmed" in element + assert "total_cases" in element assert "active" in element + assert "active_cases" in element assert "deaths" in element assert "recovered" in element assert "new_cases" in element