Exemplo n.º 1
0
 def test_clone_without_full(self):
     """Cloning should remove certain fields."""
     filter = PartnersFilter(
             tags=['C'],
             locations={'city': 'A', 'state': 'B'})
     expected_with_city = PartnersFilter(
             tags=['C'],
             locations={'city': 'A'})
     expected_with_state = PartnersFilter(
             tags=['C'],
             locations={'state': 'B'})
     self.assertEqual(expected_with_state, filter.clone_without_city())
     self.assertEqual(expected_with_city, filter.clone_without_state())
Exemplo n.º 2
0
 def test_clone_without_full(self):
     """Cloning should remove certain fields."""
     filter = PartnersFilter(tags=AndGroupFilter(
         [OrGroupFilter([MatchFilter('C')])]),
                             locations=CompositeAndFilter({
                                 'city':
                                 MatchFilter('A'),
                                 'state':
                                 MatchFilter('B')
                             }))
     expected_with_city = PartnersFilter(
         tags=AndGroupFilter([OrGroupFilter([MatchFilter('C')])]),
         locations=CompositeAndFilter({'city': MatchFilter('A')}))
     expected_with_state = PartnersFilter(
         tags=AndGroupFilter([OrGroupFilter([MatchFilter('C')])]),
         locations=CompositeAndFilter({'state': MatchFilter('B')}))
     self.assertEqual(expected_with_state, filter.clone_without_city())
     self.assertEqual(expected_with_city, filter.clone_without_state())
 def test_clone_without_full(self):
     """Cloning should remove certain fields."""
     filter = PartnersFilter(
             tags=AndGroupFilter([
                 OrGroupFilter([MatchFilter('C')])]),
             locations=CompositeAndFilter({
                 'city': MatchFilter('A'),
                 'state': MatchFilter('B')}))
     expected_with_city = PartnersFilter(
             tags=AndGroupFilter([
                 OrGroupFilter([MatchFilter('C')])]),
             locations=CompositeAndFilter({
                 'city': MatchFilter('A')}))
     expected_with_state = PartnersFilter(
             tags=AndGroupFilter([
                 OrGroupFilter([MatchFilter('C')])]),
             locations=CompositeAndFilter({
                 'state': MatchFilter('B')}))
     self.assertEqual(expected_with_state, filter.clone_without_city())
     self.assertEqual(expected_with_city, filter.clone_without_state())
Exemplo n.º 4
0
 def test_clone_without_empty(self):
     """Cloning empty filters shouldn't crash."""
     filter = PartnersFilter()
     self.assertEqual(PartnersFilter(), filter.clone_without_city())
     self.assertEqual(PartnersFilter(), filter.clone_without_state())
Exemplo n.º 5
0
 def test_clone_without_empty(self):
     """Cloning empty filters shouldn't crash."""
     filter = PartnersFilter()
     self.assertEqual(PartnersFilter(), filter.clone_without_city())
     self.assertEqual(PartnersFilter(), filter.clone_without_state())