简体   繁体   中英

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

I'm trying to import the unit test from a __init__.py file. 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就可以解决所有问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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