我正在写一些unittest,想用AssertIn进行字符串比较。在
我有一个实例对象Cooper,属性为FBI,返回str类型
代码很简单要测试的类:
class Cooper():
...
@property
def FBI(self):
return self._FBI
在单元测试中:
^{pr2}$在阅读了Function assertIn causes the UnicodeDecodeError之后,我检查了代码的第一行是#——编码:utf-8--
但我得到的输出是:
twinpeaks/CopperFBI /home/twinpeaks/CooperFBIdkaéfjkfjfdéjdakél' <class 'str'> <class 'str'>
True
E.s
======================================================================
ERROR: test_class_Path (Code.tests.UtilsTests.UtilsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/twinpeaks/PythonCode/Code/tests/UtilsTests.py", line 68, in test_Cooper
self.assertIn(Cooper.FBI,p)
File "/home/twinpeaks/anaconda3/envs/ana3/lib/python3.6/unittest/case.py", line 1085, in assertIn
if member not in container:
TypeError: 'in <string>' requires string as left operand, not NoneType
有什么问题吗?我有点卡住了,那里。。。在
目前没有回答
相关问题 更多 >
编程相关推荐