0
以下功能:nosetests通过临时字符串混淆反对
def test_1():
assert str(squishtest.object.properties(squishtest.waitForObject(":my_button"))["text"]) == "Another button"
给出:
AssertionError:
>> assert str(<module 'squish' from '.../squishtest.so'>.object.properties(<module 'squish' from '.../squishtest.so'>.waitForObject(":my_button"))["text"]) == "Another button"
这给了我关于什么文本按钮实际上包含任何信息。
然而,这工作得更好:
def test_2():
s = str(squishtest.object.properties(squishtest.waitForObject(":my_button"))["text"])
assert s == "Another button"
因为它提供了:
AssertionError:
'My button' = str(<module 'squish' from '.../squishtest.so'>.object.properties(<module 'squish' from '.../squishtest.so'>.waitForObject(":startVentButton_Button"))["text"])
>> assert 'My button' == "Another button"
问题是什么吗?第二个例子中有没有比我更好的解决方案?
我正在用-d标志设置运行nosetests。