From e183f6044d88b16a94d47d4bbe809dac9eb1b17a Mon Sep 17 00:00:00 2001 From: Christoph Alt <christoph.alt@fau.de> Date: Mon, 17 Oct 2022 11:29:12 +0200 Subject: [PATCH] rework of select tests --- tests/test_sqlite.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/test_sqlite.py b/tests/test_sqlite.py index a8b99d9..546b600 100644 --- a/tests/test_sqlite.py +++ b/tests/test_sqlite.py @@ -15,16 +15,21 @@ from cbutil.util import time_conversion def test_select(): assert select_stmt().strip() == "SELECT *" assert select_stmt("test").strip() == "SELECT test" - with pytest.raises(ValueError): - select_stmt("") - with pytest.raises(ValueError): - select_stmt(" ") -def test_from(): - assert from_stmt("table").strip() == "FROM table" +@pytest.mark.parametrize("select", ["", " "]) +def test_invalid_select(select): with pytest.raises(ValueError): - from_stmt("") + select_stmt(select) + + +@pytest.mark.parametrize("from_", ["table", " table ", "table "]) +def test_from_strip(from_): + assert from_stmt(from_).strip() == "FROM table" + + +@pytest.mark.parametrize("from_", ["", " "]) +def test_invalid_from(from_): with pytest.raises(ValueError): from_stmt(" ") -- GitLab