待测函数daicehanshu.py
def hanshu(xc1,xc2):
fullname=xc1+xc2
return fullname
测试函数ceshihanshu.py
import unittest
from daicehanshu import hanshu
class NameTest(unittest.TestCase):
def test_name(self):
testresult=hanshu('zhang','san')
self.assertEqual(testresult,'zhangsan')
unittest.main()