Adding upstream version 1.12.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
c8e84ec989
commit
277294eb9f
7 changed files with 71 additions and 66 deletions
|
@ -4,34 +4,10 @@ import os
|
|||
|
||||
import pytest
|
||||
|
||||
from utils import run, dbtest, set_expanded_output, is_expanded_output
|
||||
from utils import run, dbtest, set_expanded_output, is_expanded_output, assert_result_equal
|
||||
from sqlite3 import OperationalError, ProgrammingError
|
||||
|
||||
|
||||
def assert_result_equal(
|
||||
result,
|
||||
title=None,
|
||||
rows=None,
|
||||
headers=None,
|
||||
status=None,
|
||||
auto_status=True,
|
||||
assert_contains=False,
|
||||
):
|
||||
"""Assert that an sqlexecute.run() result matches the expected values."""
|
||||
if status is None and auto_status and rows:
|
||||
status = "{} row{} in set".format(len(rows), "s" if len(rows) > 1 else "")
|
||||
fields = {"title": title, "rows": rows, "headers": headers, "status": status}
|
||||
|
||||
if assert_contains:
|
||||
# Do a loose match on the results using the *in* operator.
|
||||
for key, field in fields.items():
|
||||
if field:
|
||||
assert field in result[0][key]
|
||||
else:
|
||||
# Do an exact match on the fields.
|
||||
assert result == [fields]
|
||||
|
||||
|
||||
@dbtest
|
||||
def test_conn(executor):
|
||||
run(executor, """create table test(a text)""")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue