Source code for schrodinger.test.hypothesis.strategies.ui
from hypothesis import strategies
[docs]@strategies.composite
def combobox_selections(draw, combobox):
"""
Returns a new index for the specified combobox
:param draw: A function supplied by hypothesis
:type draw: function
:param combobox: The combobox to inspect
:type combobox: schrodinger.Qt.QtGui.QCombobox
:rtype: int
:return: A new index for the combobox
"""
current_index = combobox.currentIndex()
options = [i for i in range(len(combobox)) if i != current_index]
new_index = draw(strategies.sampled_from(options))
return new_index