From 030a6565456ae741b802c9140b504ef2ec81e8a4 Mon Sep 17 00:00:00 2001
From: Christoph Alt <christoph.alt@fau.de>
Date: Mon, 17 Oct 2022 11:25:05 +0200
Subject: [PATCH] rework of where tests

---
 tests/test_sqlite.py | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/tests/test_sqlite.py b/tests/test_sqlite.py
index 0d3774f..a8b99d9 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():
-- 
GitLab