def test_bool(self, model, index, value, qtbool):
dataFrame = pandas.DataFrame([value], columns=['A'])
dataFrame['A'] = dataFrame['A'].astype(numpy.bool_)
model.setDataFrame(dataFrame)
assert not model.dataFrame().empty
assert model.dataFrame() is dataFrame
assert index.isValid()
model.enableEditing(True)
# pytest.set_trace()
# everything is already set as false and since Qt.Unchecked = 0, 0 == False
# therefore the assert will fail without further constraints
assert model.setData(index, qtbool) == value
assert model.data(index, role=Qt.DisplayRole) == value
assert model.data(index, role=Qt.EditRole) == value
assert model.data(index, role=Qt.CheckStateRole) == qtbool
assert model.data(index, role=DATAFRAME_ROLE) == value
assert isinstance(model.data(index, role=DATAFRAME_ROLE), numpy.bool_)
评论列表
文章目录