Test function get_formatted_cityname (), function code below (running)
Def get_formatted_cityname (city, country) :
"' get a clean city, the national format '"'
Result=city + + country
'Print (result. Title ())
The test code below:
The import unittest
The from city_functions import get_formatted_cityname
The class CityTestCase (unittest. TestCase) :
Testing whether get_formatted_cityname available "" "" ""
Def test_city_country (self) :
"" "test city_functions "" "
Formatted_name=get_formatted_cityname (" kaifeng ", "henan")
Self. AssertEqual (formatted_name, 'Kaifeng Henan')
Unittest. The main ()
After the run test code shows the result is as follows (IDE Pycharm) :