import unittest
def get_formatted_name(first, last):
full_name = first + ' ' + last
return full_name.title()
class NamesTestCase(unittest.TestCase):
def test_first_last_name(self):
formatted_name = get_formatted_name('john', 'smith')
self.assertEqual(formatted_name, 'John Smith')
unittest.main()
所以我对Python还是相当陌生的,这是我第一次使用unittest
。我正试图使用unittest
测试get_formatted_name
函数,但它总是返回:
Ran 0 test in 0.00s
OK
我假设我的NamesTestCase
class
出了问题,有人看到什么问题了吗?你知道吗
谢谢。你知道吗
我在我的本地服务器上试用了你的代码,效果很好
我使用的是python2.7.14。你知道吗
相关问题 更多 >
编程相关推荐