Python 3.x 获取Python错误,";类型错误:';非类型';对象不可调用";有时

Python 3.x 获取Python错误,";类型错误:';非类型';对象不可调用";有时,python-3.x,pyserial,nose,python-unittest,Python 3.x,Pyserial,Nose,Python Unittest,对编程或python来说不是很新鲜,但对使用pyunit来说却是难以置信的绿色。我需要在我的新工作中使用它,我不断地遇到这个错误,但只有在它运行时才会出现。下面是我的代码 import unittest from nose_parameterized import parameterized from CheckFromFile import listFileCheck, RepresentsFloat testParams = listFileCheck() class TestSeq

对编程或python来说不是很新鲜,但对使用pyunit来说却是难以置信的绿色。我需要在我的新工作中使用它,我不断地遇到这个错误,但只有在它运行时才会出现。下面是我的代码

import unittest

from nose_parameterized import parameterized
from CheckFromFile import listFileCheck, RepresentsFloat

testParams = listFileCheck()


class TestSequence(unittest.TestCase):

    @parameterized.expand(testParams)
    def test_sequence(self, name, a, b):
        if RepresentsFloat(a):
            self.assertAlmostEqual(a,b,2)
        else:
            self.assertEqual(a,b)


if __name__ == '__main__':
    unittest.main()
这里发生的是,我的测试用例正在从另一个类中提取一个方法listFileCheck。它所做的是从与控制板通信的串行端口读取值,并将其与校准文件进行比较。它将控制板值与校准文件值一起放入MD数组中。这些值可以是str、int或float

我使用测试用例将这些值彼此进行比较,但是我不断地得到这个错误,但只是有时候。大约每运行3次后,它就会因此错误而失败

Error
Traceback (most recent call last):
  File "C:\Python34\lib\unittest\case.py", line 57, in testPartExecutor
    yield
  File "C:\Python34\lib\unittest\case.py", line 574, in run
    testMethod()
TypeError: 'NoneType' object is not callable


Process finished with exit code 0 

有人知道我为什么会偶尔遇到这个错误吗?

我可能是因为装饰器返回的函数与未装饰的函数不匹配。我将更深入地研究从
listFileCheck
中得到的内容。我已经检查了它,它总是返回相同类型的列表。我想我的问题其实是我的IDE。我在使用pycharm,出于某种原因,它只是运行测试用例,而不是整个套装,因此可能会导致问题?好的:)谢谢您的反馈。