'module' object has no attribute
-- coding: utf-8 --
import unittest
from name_function import get_formatted_name
class NamesTestCase(unittest.TestCase):
“”“测试name_function.py”""
def test_first_last_name(self):
"""能够正确地处理像Janis Joplin这样的姓名吗?"""
formatted_name = get_formatted_name('Janis','Joplin')
self.assertEqual(formatted_name,'Janis Joplin')
unittest.main()
Traceback (most recent call last):
File “C:\Program Files (x86)\JetBrains\PyCharm Edu 3.5\helpers\pycharm\utrunner.py”, line 153, in
modules = [loadSource(a[0])]
File “C:\Program Files (x86)\JetBrains\PyCharm Edu 3.5\helpers\pycharm\utrunner.py”, line 65, in loadSource
module = imp.load_source(moduleName, fileName)
File “F:\Program Files (x86)\mcpipy\ceshiyongli.py”, line 13, in
unittest.main()
File “C:\Python27\lib\unittest\main.py”, line 94, in init
self.parseArgs(argv)
File “C:\Python27\lib\unittest\main.py”, line 149, in parseArgs
self.createTests()
File “C:\Python27\lib\unittest\main.py”, line 158, in createTests
self.module)
File “C:\Python27\lib\unittest\loader.py”, line 130, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File “C:\Python27\lib\unittest\loader.py”, line 100, in loadTestsFromName
parent, obj = obj, getattr(obj, part)
AttributeError: ‘module’ object has no attribute ‘F:\Program Files (x86)\mcpipy\ceshiyongli’
Process finished with exit code 1
请问大神改如何解决?
上一篇: str‘ object has no attribute ‘decode‘解决办法
下一篇: AttributeError: 'GridSearchCV' object has no attribute 'grid_scores_'
推荐阅读
-
module ‘community‘ has no attribute ‘best_partition‘ [已解决]
-
【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题
-
【Tensorflow】Linux下Tensorflow报错:AttributeError: module ‘tensorflow‘ has no attribute ‘xxxx‘
-
AttributeError: 'module' object has no attribute 'main'
-
mongdb "errmsg" : "exception: 'out' has to be a string or an object"
-
AttributeError: module 'sklearn' has no attribute 'linear_model'
-
解决Keras报错AttributeError: 'NoneType' object has no attribute 'inbound_nodes'
-
解决'DataFrame' object has no attribute 'sort'
-
‘MyObject‘ object has no attribute ‘***‘
-
AttributeError: ‘NoneType‘ object has no attribute ‘origin‘解决办法