def test_clone_without_empty(self): """ Cloning empty filters shouldn't crash. """ filter = CommRecordsFilter() self.assertEqual(CommRecordsFilter(), filter.clone_without_city()) self.assertEqual(CommRecordsFilter(), filter.clone_without_state())
def test_clone_without_full(self): """Cloning should remove certain fields.""" filter = CommRecordsFilter( tags=['C'], locations={'city': 'A', 'state': 'B'}) expected_with_city = CommRecordsFilter( tags=['C'], locations={'city': 'A'}) expected_with_state = CommRecordsFilter( tags=['C'], locations={'state': '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 = CommRecordsFilter(tags=['C'], locations=CompositeAndFilter({ 'city': MatchFilter('A'), 'state': MatchFilter('B') })) expected_with_city = CommRecordsFilter(tags=['C'], locations=CompositeAndFilter( {'city': MatchFilter('A')})) expected_with_state = CommRecordsFilter( tags=['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 = CommRecordsFilter( tags=['C'], locations=CompositeAndFilter({ 'city': MatchFilter('A'), 'state': MatchFilter('B')})) expected_with_city = CommRecordsFilter( tags=['C'], locations=CompositeAndFilter({ 'city': MatchFilter('A')})) expected_with_state = CommRecordsFilter( tags=['C'], locations=CompositeAndFilter({ 'state': MatchFilter('B')})) self.assertEqual(expected_with_state, filter.clone_without_city()) self.assertEqual(expected_with_city, filter.clone_without_state())