測驗函式get_formatted_cityname(),函式代碼見下(運行正常)
def get_formatted_cityname(city, country):
'''得到整潔的城市,國家格式'''
result = city + ' ' + country
print(result.title())
測驗代碼見下:
import unittest
from city_functions import get_formatted_cityname
class CityTestCase(unittest.TestCase):
"""測驗get_formatted_cityname是否可用"""
def test_city_country(self):
"""測驗city_functions"""
formatted_name = get_formatted_cityname('kaifeng', 'henan')
self.assertEqual(formatted_name, 'Kaifeng Henan')
unittest.main()
run測驗代碼后顯示結果如下(IDE為Pycharm):
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/92052.html
上一篇:求教雙向dijkstra大佬們
下一篇:請教,PowerApps開發應用
