def test_filter_from_non_operator_arg(self): pair = Filter.from_arg('name', '12') self.assertEqual('name', pair.name) self.assertEqual(12, pair.value) self.assertEqual(operator.eq, pair.operator)
def test_filter_from_gt_operator_arg(self): pair = Filter.from_arg('age[gt]', '18') self.assertEqual('age', pair.name) self.assertEqual(18, pair.value) self.assertEqual(operator.gt, pair.operator)
def get_arg(args, arg, ignore_type): return Filter.from_arg(arg, args[arg], ignore_type)