Example #1
0
class TestCoronaADT(unittest.TestCase):
    def setUp(self) -> None:
        self.country = "USA"
        self.corona = CoronaADT(self.country)

    def test_APIs(self):
        # test all the APIs:
        self.assertIsInstance(self.corona.get_affected_countries(), dict)
        self.assertIsInstance(
            self.corona.get_history_by_particular_country(self.country), dict)
        self.assertIsInstance(self.corona.get_cases_by_land(), dict)
        self.assertIsInstance(
            self.corona.get_latest_stat_by_country_name(self.country), dict)
        self.assertIsInstance(self.corona.get_world_total_stat(), dict)

    def test_all_cases(self):
        # Get test results based on recorded information from beginning
        self.assertIsInstance(self.corona.get_infected(), int)
        self.assertIsInstance(self.corona.get_recovered(), int)
        self.assertIsInstance(self.corona.get_deaths(), int)
        try:
            self.assertIsInstance(self.corona.get_total_cases_per1m(), float)
        except AssertionError:
            self.assertIsInstance(self.corona.get_total_cases_per1m(), int)

    def test_day_cases(self):
        # Get test results based on recorded information from the current day
        self.assertIsInstance(self.corona.get_new_cases(), int)
        self.assertIsInstance(self.corona.get_active_cases(), int)
        self.assertIsInstance(self.corona.get_new_deaths(), int)
        self.assertIsInstance(self.corona.get_serious_critical(), int)
        self.assertIsInstance(self.corona.get_record_date(), str)

    def test_interface(self):
        pass
Example #2
0
c = CoronaADT()
c.country = "USA"

print("NOTE!!! The information provided " "is about a week long in time.")

print("The country we get the information for is:")
print(c.country)

print("Amount of people who wre " "infected in {}".format(c.country))
print(c.get_infected())

print("Amount of people who have " "recovered in {}".format(c.country))
print(c.get_recovered())

print("Amount of people who have " "died in {}".format(c.country))
print(c.get_deaths())

print("Amount of people who got " "infected today in {}".format(c.country))
print(c.get_new_cases)

print("Amount of people who have " "died today in {}".format(c.country))
print(c.get_new_deaths())

print("Information about the country")
print(c.__str__())

print("The last recorded tame was:")
print(c.get_record_date())

print("Whole world statistics")
print(c.get_world_total_stat())