Beispiel #1
0
 def test_filtering_skipped_with_none_value(self):
     qs = mock.Mock(spec=['filter'])
     f = RangeFilter()
     result = f.filter(qs, None)
     self.assertEqual(qs, result)
Beispiel #2
0
 def test_filtering_ignores_lookup_type(self):
     qs = mock.Mock()
     value = mock.Mock(start=20, stop=30)
     f = RangeFilter(lookup_type='gte')
     f.filter(qs, value)
     qs.filter.assert_called_once_with(None__range=(20, 30))
Beispiel #3
0
 def test_filtering_start(self):
     qs = mock.Mock(spec=['filter'])
     value = mock.Mock(start=20, stop=None)
     f = RangeFilter()
     f.filter(qs, value)
     qs.filter.assert_called_once_with(None__gte=20)
Beispiel #4
0
 def test_filtering(self):
     qs = mock.Mock(spec=['filter'])
     value = mock.Mock(start=20, stop=30)
     f = RangeFilter()
     f.filter(qs, value)
     qs.filter.assert_called_once_with(None__range=(20, 30))
Beispiel #5
0
 def test_filtering_exclude(self):
     qs = mock.Mock(spec=['exclude'])
     value = mock.Mock(start=20, stop=30)
     f = RangeFilter(exclude=True)
     f.filter(qs, value)
     qs.exclude.assert_called_once_with(None__range=(20, 30))
 def test_filtering_ignores_lookup_type(self):
     qs = mock.Mock()
     value = mock.Mock(start=20, stop=30)
     f = RangeFilter(lookup_type='gte')
     f.filter(qs, value)
     qs.filter.assert_called_once_with(None__range=(20, 30))
 def test_filtering_skipped_with_none_value(self):
     qs = mock.Mock(spec=['filter'])
     f = RangeFilter()
     result = f.filter(qs, None)
     self.assertEqual(qs, result)
 def test_filtering_stop(self):
     qs = mock.Mock(spec=['filter'])
     value = mock.Mock(start=None, stop=30)
     f = RangeFilter()
     f.filter(qs, value)
     qs.filter.assert_called_once_with(None__lte=30)
 def test_filtering_exclude(self):
     qs = mock.Mock(spec=['exclude'])
     value = mock.Mock(start=20, stop=30)
     f = RangeFilter(exclude=True)
     f.filter(qs, value)
     qs.exclude.assert_called_once_with(None__range=(20, 30))