gpt4 book ai didi

python - 导入错误 : cannot import name 'Testcase' from 'unittest'

转载 作者:行者123 更新时间:2023-11-28 20:36:46 24 4
gpt4 key购买 nike

我正在尝试从 __init__.py 文件导入单元测试。因此我得到了错误

ImportError: cannot import name 'Testcase' from 'unittest'

如果我错了,请澄清我。

最佳答案

使用:

from unittest import TestCase

unittest.TestCase 

例子:

import unittest
class TestFoo(unittest.TestCase):
def a:
return ()

问题在于大小写敏感度

关于python - 导入错误 : cannot import name 'Testcase' from 'unittest' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51531910/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com