以下功能:
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标志做鼻测试。你知道吗
通常您会使用以下内容:
但是等等,鼻子有这样一个shorthand:
from nose.tools import eq_
因此,对于您的情况,您将有:
相关问题 更多 >
编程相关推荐