Skip to content

Commit

Permalink
refactor(test, paramstyle): adjust to order result set
Browse files Browse the repository at this point in the history
Brooke-white committed Dec 6, 2021
1 parent 18db5df commit 1e59dfb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/integration/test_paramstyle.py
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ def test_pyformat(cursor, parameters):
[
(
({"c1": "abc", "c2": "defg", "c3": "hijkl"}, {"c1": "a", "c2": "b", "c3": "c"}),
[["abc", "defg", "hijkl"], ["a", "b", "c"]],
[["a", "b", "c"], ["abc", "defg", "hijkl"]],
),
],
)
@@ -36,7 +36,7 @@ def test_pyformat_multiple_insert(cursor, parameters):
data, exp_result = parameters
cursor.execute("create temporary table test_pyformat(c1 varchar, c2 varchar, c3 varchar)")
cursor.executemany("insert into test_pyformat(c1, c2, c3) values(%(c1)s, %(c2)s, %(c3)s)", data)
cursor.execute("select * from test_pyformat")
cursor.execute("select * from test_pyformat order by c1")
res: typing.Tuple[typing.List[str, str, str], ...] = cursor.fetchall()
assert len(res) == len(exp_result)
for idx, row in enumerate(res):
@@ -111,15 +111,15 @@ def test_format(cursor, parameters):
@pytest.mark.parametrize(
"parameters",
[
([["abc", "defg", "hijkl"], ["a", "b", "c"]], [["abc", "defg", "hijkl"], ["a", "b", "c"]]),
([["abc", "defg", "hijkl"], ["a", "b", "c"]], [["a", "b", "c"], ["abc", "defg", "hijkl"]]),
],
)
def test_format_multiple(cursor, parameters):
cursor.paramstyle = "format"
data, exp_result = parameters
cursor.execute("create temporary table test_format(c1 varchar, c2 varchar, c3 varchar)")
cursor.executemany("insert into test_format(c1, c2, c3) values(%s, %s, %s)", data)
cursor.execute("select * from test_format")
cursor.execute("select * from test_format order by c1")
res: typing.Tuple[typing.List[str, str, str], ...] = cursor.fetchall()
assert len(res) == len(exp_result)
for idx, row in enumerate(res):

0 comments on commit 1e59dfb

Please sign in to comment.