diff --git a/tests/test_utils.py b/tests/test_utils.py index e37fd325..a8b0e379 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -49,50 +49,49 @@ def test_custom_json_encoder(obj, expected): @pytest.mark.parametrize('args,expected_where,expected_params', [ ( { - 'name_english__contains': ['foo'], + 'name_english__contains': 'foo', }, - '"name_english" like :p0', + ['"name_english" like :p0'], ['%foo%'] ), ( { - 'foo': ['bar'], - 'bar__contains': ['baz'], + 'foo': 'bar', + 'bar__contains': 'baz', }, - '"bar" like :p0 and "foo" = :p1', + ['"bar" like :p0', '"foo" = :p1'], ['%baz%', 'bar'] ), ( { - 'foo__startswith': ['bar'], - 'bar__endswith': ['baz'], + 'foo__startswith': 'bar', + 'bar__endswith': 'baz', }, - '"bar" like :p0 and "foo" like :p1', + ['"bar" like :p0', '"foo" like :p1'], ['%baz', 'bar%'] ), ( { - 'foo__lt': ['1'], - 'bar__gt': ['2'], - 'baz__gte': ['3'], - 'bax__lte': ['4'], + 'foo__lt': '1', + 'bar__gt': '2', + 'baz__gte': '3', + 'bax__lte': '4', }, - '"bar" > :p0 and "bax" <= :p1 and "baz" >= :p2 and "foo" < :p3', + ['"bar" > :p0', '"bax" <= :p1', '"baz" >= :p2', '"foo" < :p3'], [2, 4, 3, 1] ), ( { - 'foo__like': ['2%2'], - 'zax__glob': ['3*'], + 'foo__like': '2%2', + 'zax__glob': '3*', }, - '"foo" like :p0 and "zax" glob :p1', + ['"foo" like :p0', '"zax" glob :p1'], ['2%2', '3*'] ), ]) def test_build_where(args, expected_where, expected_params): sql_bits, actual_params = utils.build_where_clauses(args) - actual_where = ' and '.join(sql_bits) - assert expected_where == actual_where + assert expected_where == sql_bits assert { 'p{}'.format(i): param for i, param in enumerate(expected_params)