def test__get_patterns_for_not_noop(self): """ Test that _get_patterns_for_not does nothing to the filter if there is no `$not` operator. """ some_filter = {'key': {'$eq': 'value'}} filter_copy = criteria._get_patterns_for_not(some_filter) self.assertEqual(some_filter, filter_copy)
def test__get_patterns_for_not(self): """ Test that a pattern is obtained from the regex object. """ regex = '^regexp?$' some_filter = {'key': {'$not': re.compile(regex)}} filter_copy = criteria._get_patterns_for_not(some_filter) self.assertEqual(filter_copy['key']['$not'], regex)