

def test_filtering_exclude(self):
    qs = mock.Mock(spec=['exclude'])
    f = MultipleChoiceFilter(name='somefield', exclude=True)
    with mock.patch('django_filters.filters.Q') as mockQclass:
        (mockQ1, mockQ2) = (mock.MagicMock(), mock.MagicMock())
        mockQclass.side_effect = [mockQ1, mockQ2]
        mockQ1.filter(qs, ['value'])
        self.assertEqual(mockQclass.call_args_list, [mock.call(), mock.call(somefield='value')])
        mockQ1.__ior__.assert_called_once_with(mockQ2)
        qs.exclude.assert_called_once_with(mockQ1.__ior__.return_value)
        qs.exclude.return_value.distinct.assert_called_once_with()

dataset/ETHPy150Open carltongibson/django-filter/tests/test_filters.py MultipleChoiceFilterTests.test_filtering_exclude/VarMisuse@78/113 `f`->`mockQ1`