def test_is_match_returns_false_after_range(self): mock_context = mock.Mock() task = mock.Mock() task.index = 785 self.assertFalse( taskindexfilter.TaskIndexRangeFilter(mock_context, 56, 784).is_match(task))
def test_is_match_returns_false_before_range(self): mock_context = mock.Mock() task = mock.Mock() task.index = 1 self.assertFalse( taskindexfilter.TaskIndexRangeFilter(mock_context, 301, 999).is_match(task))
def test_is_match_returns_true_on_end_of_range(self): mock_context = mock.Mock() task = mock.Mock() task.index = 79 self.assertTrue( taskindexfilter.TaskIndexRangeFilter(mock_context, 75, 79).is_match(task))
def test_string_representation_contains_class_and_indexes(self): description = str( taskindexfilter.TaskIndexRangeFilter(mock.Mock(), 56, 784)) self.assertIn('TaskIndexRangeFilter', description) self.assertIn('56', description) self.assertIn('784', description)
def test_constructor_raises_when_range_end_before_start(self): with self.assertRaises(Exception): taskindexfilter.TaskIndexRangeFilter(mock.Mock(), 345, 23)
def test_constructor_sets_indexes(self): target = taskindexfilter.TaskIndexRangeFilter(mock.Mock(), 30, 199) self.assertEqual(30, target.start_index) self.assertEqual(199, target.end_index)