def test_remove_items_filtered_data_midle(self): items = set('bb') model = FilterCheckboxListModel() model.set_list(self.data) model.set_filter('b') with mock.patch("tabularview_models.FilterCheckboxListModel.beginResetModel") as br, \ mock.patch("tabularview_models.FilterCheckboxListModel.endResetModel") as er: model.remove_items(items) self.assertEqual(model._filter_index, [3,4])
def test_remove_items_selected(self): items = set('a') model = FilterCheckboxListModel() model.set_list(self.data) with mock.patch("tabularview_models.FilterCheckboxListModel.beginResetModel") as br, \ mock.patch("tabularview_models.FilterCheckboxListModel.endResetModel") as er: model.remove_items(items) self.assertEqual(model._selected, set(self.data[1:])) self.assertTrue(model._all_selected)
def test_remove_items_filtered_data_not_selected(self): items = set('b') model = FilterCheckboxListModel() model.set_list(self.data) model.set_filter('b') model._selected_filtered.discard('a') model._all_selected = False with mock.patch("tabularview_models.FilterCheckboxListModel.beginResetModel") as br, \ mock.patch("tabularview_models.FilterCheckboxListModel.endResetModel") as er: model.remove_items(items) self.assertEqual(model._selected_filtered, set(self.data[4:])) self.assertTrue(model._all_selected)