Example #1
0
 def test_filtering_ignores_lookup_expr(self):
     qs = mock.Mock()
     value = mock.Mock(start=time(10, 15), stop=time(12, 30))
     f = TimeRangeFilter(lookup_expr='gte')
     f.filter(qs, value)
     qs.filter.assert_called_once_with(
         None__range=(time(10, 15), time(12, 30)))
Example #2
0
 def test_filtering_range(self):
     qs = mock.Mock(spec=['filter'])
     value = mock.Mock(start=time(10, 15), stop=time(12, 30))
     f = TimeRangeFilter()
     f.filter(qs, value)
     qs.filter.assert_called_once_with(
         None__range=(time(10, 15), time(12, 30)))
 def test_filtering_ignores_lookup_type(self):
     qs = mock.Mock()
     value = mock.Mock(start=time(10, 15), stop=time(12, 30))
     f = TimeRangeFilter(lookup_type='gte')
     f.filter(qs, value)
     qs.filter.assert_called_once_with(
         None__range=(time(10, 15), time(12, 30)))
 def test_filtering_range(self):
     qs = mock.Mock(spec=['filter'])
     value = mock.Mock(start=time(10, 15), stop=time(12, 30))
     f = TimeRangeFilter()
     f.filter(qs, value)
     qs.filter.assert_called_once_with(
         None__range=(time(10, 15), time(12, 30)))
Example #5
0
 def test_filtering_skipped_with_none_value(self):
     qs = mock.Mock(spec=['filter'])
     f = TimeRangeFilter()
     result = f.filter(qs, None)
     self.assertEqual(qs, result)
Example #6
0
 def test_filtering_start(self):
     qs = mock.Mock(spec=['filter'])
     value = mock.Mock(start=time(10, 15), stop=None)
     f = TimeRangeFilter()
     f.filter(qs, value)
     qs.filter.assert_called_once_with(None__gte=time(10, 15))
 def test_filtering_skipped_with_none_value(self):
     qs = mock.Mock(spec=['filter'])
     f = TimeRangeFilter()
     result = f.filter(qs, None)
     self.assertEqual(qs, result)
 def test_filtering_start(self):
     qs = mock.Mock(spec=['filter'])
     value = mock.Mock(start=time(10, 15), stop=None)
     f = TimeRangeFilter()
     f.filter(qs, value)
     qs.filter.assert_called_once_with(None__gte=time(10, 15))