【发布时间】:2012-10-12 05:24:09
【问题描述】:
我正在测试一个 Python 脚本,该脚本在执行时会抛出一堆字节(作为字符串)。
首先,我得到结果:
myOutput = subprocess.check_output(["python","../src/myScript.py"])
有了这个,我执行脚本并获得输出。
然后我将这个结果与一个很长的预期输出进行比较:
expOutput = "382d006e756c6c2c7465737453657450726f706572747953823c75652c6c75614170702c63617074696f6e2c486f6c61206d756e646f203200"
self.assertEqual(myOutput, expOutput, "Script output is not the expected")
(这只是一个愚蠢的测试,我正在尝试让事情正常工作)。
问题:我的测试失败。调试我发现值是相等的。
谁能帮助我?
谢谢!
【问题讨论】:
-
assertEqual 中的代码是什么?
标签: python string unit-testing subprocess python-unittest