简体   繁体   English

ImportError:无法从“ unittest”导入名称“ Testcase”

[英]ImportError: cannot import name 'Testcase' from 'unittest'

I'm trying to import the unit test from a __init__.py file. 我正在尝试从__init__.py文件导入单元测试。 Hence I'm getting the error 因此,我得到了错误

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

Clarify me if I'm wrong. 如果我错了请澄清我。

use : 采用 :

from unittest import TestCase

or 要么

unittest.TestCase 

example: 例:

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

issue was with the case sentivity 问题在于案件的情感

我认为只要这样做=>导入unittest就可以解决所有问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM