Skip to content

Commit

Permalink
adds new fields
Browse files Browse the repository at this point in the history
  • Loading branch information
nf1s committed May 30, 2021
1 parent b5f9faa commit 32a8170
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion covid/worldometers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions tests/test_worldometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 32a8170

Please sign in to comment.