def test_str_works(self): canada = core.Country('Canada', 34482779, 9984670) mexico = core.Country('Mexico', 112336538, 1943950) usa = core.Country('United States of America', 313914040, 9826675) na = core.Continent("North America", [canada, mexico, usa]) assert str(na) == '''North America
def test_Country_init_works(self): c = core.Country('a', 1, 2) assert c.name == 'a' assert c.population == 1 assert c.area == 2
def test_total_population_works(self): canada = core.Country('Canada', 34482779, 9984670) mexico = core.Country('Mexico', 112336538, 1943950) usa = core.Country('United States of America', 313914040, 9826675) na = core.Continent("North America", [canada, mexico, usa]) assert na.total_population() == 460733357
def test_repr_works(self): a = core.Country('a', 45, 20) assert repr([a]) == "[Country('a', 45, 20)]"
def test_str_works(self): a = core.Country('a', 4, 21) assert str(a) == 'a has a population of 4 and is 21 square km.'
def test_population_density_works(self): a = core.Country('wow', 100, 200) assert a.population_density() == 0.5
def test_is_larger_works(self): a = core.Country('a', 3, 2) b = core.Country('b', 1, 3) assert a.is_larger(b) == True