def test_batch_set_data(self): model = TimePatternModel(TimePattern(['a', 'b', 'c'], [-5.0, 3.0, 7.0])) indexes = [model.index(0, 0), model.index(1, 1), model.index(2, 1)] values = ['A', 55.5, -55.5] model.batch_set_data(indexes, values) expected = TimePattern(['A', 'b', 'c'], [-5.0, 55.5, -55.5]) self.assertEqual(model.value, expected)
def test_flags(self): model = TimePatternModel(TimePattern(["", ""], [0.0, 0.0])) for row in range(len(model.value)): for column in range(2): model_index = model.index(row, column) self.assertEqual( model.flags(model_index), Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
def test_setData(self): model = TimePatternModel(TimePattern(['a', 'b'], [-5.0, 7.0])) model_index = model.index(1, 1) model.setData(model_index, 2.3) self.assertEqual(model.value.indexes, ['a', 'b']) numpy.testing.assert_equal(model.value.values, [-5.0, 2.3])