Code: Alles auswählen
def city_country(city, country, population=0):
"""Retrun it back."""
if population:
c_c = city.title() + ' ' + ' ' + country.title() + ' ' + str(population)
else:
c_c = city.title() + ' ' + country.title()
return c_c
/code]
[code]import unittest
from city_functions import city_country
class NameTestCase(unittest.TestCase):
"""Tests for city country."""
def test_city_country(self):
"""Work the string city country work"""
beirut_lebanon = city_country('beirut', 'lebanon')
self.assertEqual(beirut_lebanon, 'Beirut Lebanon')
def test_city_country_population(self):
"""Work the city, country, population."""
beirut_lebanon_population = city_country(
'new-york', 'america', 500000
)
self.assertEqual(beirut_lebanon_population, 'New-York America', 500000)
unittest.main()
/code]
Immer wieder wen ich versuche den code auszuführen gibt es mir einen Fehler aus dass etwas Falsch ist an der code Zeile selfessertEqual
aber wen ich bei der Oberligen Zeile die 500000 auslasse und unten stehen lasse bei selfEqual funktioniert der code