diff --git a/tests/test_sqlite.py b/tests/test_sqlite.py index 0d3774f3712c6a89798cf283509fabceaa450342..a8b99d9acec83afd93c959f559b5bd30b0e00547 100644 --- a/tests/test_sqlite.py +++ b/tests/test_sqlite.py @@ -29,22 +29,19 @@ def test_from(): from_stmt(" ") -def test_where(): - lhs = "lhs" - rhs = "rhs" - assert where_stmt(lhs, rhs).strip() == f"WHERE {lhs}={rhs}" - with pytest.raises(ValueError): - where_stmt("", lhs) - with pytest.raises(ValueError): - where_stmt(" ", lhs) - with pytest.raises(ValueError): - where_stmt(rhs, "") - with pytest.raises(ValueError): - where_stmt(rhs, " ") +@pytest.mark.parametrize("lhs", ["lhs", " lhs ", "lhs "]) +@pytest.mark.parametrize("rhs", ["rhs", "rhs ", " rhs "]) +def test_where_strip(lhs, rhs): + assert where_stmt(lhs, rhs).strip() == "WHERE lhs=rhs" + + +@pytest.mark.parametrize("lhs", ["", " ", " "]) +@pytest.mark.parametrize("rhs", ["rhs", "rhs ", " rhs "]) +def test_invalid_lhs_wheres(lhs, rhs): with pytest.raises(ValueError): - where_stmt(rhs, lhs, "") + where_stmt(lhs, rhs) with pytest.raises(ValueError): - where_stmt(rhs, lhs, " ") + where_stmt(rhs, lhs) def test_join():