找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 2767|回复: 0

[求助] 测试类的时候报错Ran 0 tests in 0.000s

1

主题

2

帖子

2

积分

贫民

积分
2
ysz 发表于 2021-6-9 00:41:14 | 显示全部楼层 |阅读模式

import unittest
def get_formatted_name(first,last):
    full_name = first+' '+last
    return full_name

class NameTestCase(unittest.TestCase):

    def test_first_last_name(self):
        formatted_name = get_formatted_name('janis','joplim')
        self.assertEqual(formatted_name,'janis joplim')
unittest.main()#我看到网络上的解答说是在这个前面加个if __name__ == '__main__':但是不知道为什么#还有一个是直接删掉unittest.main()也可以直接测试


----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

进程已结束,退出代码 0

Empty suite

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表