Example #1
0
 def test_remove_filter(self):
     model = FilterCheckboxListModel()
     model.set_list(self.data)
     model.set_filter('b')
     model.remove_filter()
     self.assertFalse(model._is_filtered)
     self.assertEqual(model._selected, set(self.data))
     self.assertEqual(model.rowCount(), 8)
Example #2
0
 def test_apply_filter_with_replace(self):
     model = FilterCheckboxListModel()
     model.set_list(self.data)
     model.set_filter('b')
     model.apply_filter()
     self.assertFalse(model._is_filtered)
     self.assertEqual(model._selected, set(self.data[3:]))
     self.assertEqual(model.rowCount(), 8)
     self.assertFalse(model._empty_selected)
Example #3
0
 def test_apply_filter_with_add(self):
     model = FilterCheckboxListModel()
     model.set_list(self.data)
     model.set_filter('b')
     model._add_to_selection = True
     model._selected_filtered.discard('bbb')
     model.apply_filter()
     self.assertFalse(model._is_filtered)
     self.assertEqual(model._selected, set(self.data[:5]))
     self.assertEqual(model.rowCount(), 8)
     self.assertFalse(model._all_selected)
Example #4
0
 def test_rowCount_when_filter(self):
     model = FilterCheckboxListModel()
     model.set_list(self.data)
     model.set_filter('b')
     self.assertEqual(model.rowCount(), 5)