Fix/fixes get top billionaries code (#11466)

* fix: modify the depracated code and add new tests

* fix: remove test from pr

* fix: remove the useless utc import

* fix: add explicit tz argument

* fix: fixes ruff checking

* Remove UP017 #noqa comments from code

* Update get_top_billionaires.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update get_top_billionaires.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
raj 2024-06-16 19:17:55 -03:00 committed by GitHub
parent af6a45e982
commit df94d460ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,7 +65,7 @@ def get_forbes_real_time_billionaires() -> list[dict[str, int | str]]:
"Country": person["countryOfCitizenship"], "Country": person["countryOfCitizenship"],
"Gender": person["gender"], "Gender": person["gender"],
"Worth ($)": f"{person['finalWorth'] / 1000:.1f} Billion", "Worth ($)": f"{person['finalWorth'] / 1000:.1f} Billion",
"Age": years_old(person["birthDate"]), "Age": str(years_old(person["birthDate"] / 1000)),
} }
for person in response_json["personList"]["personsLists"] for person in response_json["personList"]["personsLists"]
] ]
@ -95,4 +95,7 @@ def display_billionaires(forbes_billionaires: list[dict[str, int | str]]) -> Non
if __name__ == "__main__": if __name__ == "__main__":
from doctest import testmod
testmod()
display_billionaires(get_forbes_real_time_billionaires()) display_billionaires(get_forbes_real_time_billionaires())