|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 JasonRon 于 2018-7-11 21:00 编辑
name_function.py
- def get_formatted_name(first, last):
- """Generate a neatly formatted full name."""
- full_name = first + " " + last
- return full_name.title()
复制代码
test_name_function.py
- import unittest
- from name_function import get_formatted_name
- class NamesTestCase(unittest.TestCase):
- """测试name_function.py"""
- def test_first_last_name(self):
- """能够正确的处理像Janis Joplin这样的姓名吗?"""
- formatted_name = get_formatted_name("janis", "joplin")
- self.assertEqual(formatted_name, "Janis Joplin")
- unittest.main()
复制代码 为啥运行结果是 ran 0 test in 0.000s(这俩文件是放在一个文件夹里的)
|
|