I have a var af_button
which is a button on UI. It can be either selected or deselected, so in that case I have four possibilities, which I have implemented. I don't like this implementation, so what would be a more pythonic way of implementing this?
af_button = squishtest.waitForObject("{text='AF' type='QPushButton' unnamed='1' visible='1'}")
if state == 'click':
if af_button.checked == 1:
pass
else:
squishtest.clickButton(squishtest.waitForObject(af_button))
else:
if af_button.checked == 0:
pass
else:
squishtest.clickButton(squishtest.waitForObject(af_button))