mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-12 03:24:23 +02:00
Fix failing tests
This commit is contained in:
parent
e31cb71ed8
commit
f436a6a666
3 changed files with 35 additions and 8 deletions
|
|
@ -1907,7 +1907,16 @@ def test_insert_encoding(tmpdir):
|
|||
# Using --encoding=latin-1 should work
|
||||
good_result = CliRunner().invoke(
|
||||
cli.cli,
|
||||
["insert", db_path, "places", csv_path, "--encoding", "latin-1", "--csv", "--no-detect-types"],
|
||||
[
|
||||
"insert",
|
||||
db_path,
|
||||
"places",
|
||||
csv_path,
|
||||
"--encoding",
|
||||
"latin-1",
|
||||
"--csv",
|
||||
"--no-detect-types",
|
||||
],
|
||||
catch_exceptions=False,
|
||||
)
|
||||
assert good_result.exit_code == 0
|
||||
|
|
@ -2196,7 +2205,7 @@ def test_import_no_headers(tmpdir, args, tsv):
|
|||
csv_file.write("Tracy{sep}Spider{sep}7\n".format(sep=sep))
|
||||
result = CliRunner().invoke(
|
||||
cli.cli,
|
||||
["insert", db_path, "creatures", csv_path] + args,
|
||||
["insert", db_path, "creatures", csv_path] + args + ["--no-detect-types"],
|
||||
catch_exceptions=False,
|
||||
)
|
||||
assert result.exit_code == 0, result.output
|
||||
|
|
@ -2245,7 +2254,16 @@ def test_csv_insert_bom(tmpdir):
|
|||
fp.write(b"\xef\xbb\xbfname,age\nCleo,5")
|
||||
result = CliRunner().invoke(
|
||||
cli.cli,
|
||||
["insert", db_path, "broken", bom_csv_path, "--encoding", "utf-8", "--csv", "--no-detect-types"],
|
||||
[
|
||||
"insert",
|
||||
db_path,
|
||||
"broken",
|
||||
bom_csv_path,
|
||||
"--encoding",
|
||||
"utf-8",
|
||||
"--csv",
|
||||
"--no-detect-types",
|
||||
],
|
||||
catch_exceptions=False,
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
|
|
@ -2362,7 +2380,16 @@ def test_upsert_no_detect_types(tmpdir):
|
|||
data = "id,name,age,weight\n1,Cleo,6,45.5\n2,Dori,1,3.5"
|
||||
result = CliRunner().invoke(
|
||||
cli.cli,
|
||||
["upsert", db_path, "creatures", "-", "--csv", "--pk", "id", "--no-detect-types"],
|
||||
[
|
||||
"upsert",
|
||||
db_path,
|
||||
"creatures",
|
||||
"-",
|
||||
"--csv",
|
||||
"--pk",
|
||||
"id",
|
||||
"--no-detect-types",
|
||||
],
|
||||
catch_exceptions=False,
|
||||
input=data,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ def test_insert_csv_tsv(content, options, db_path, tmpdir):
|
|||
fp.write(content)
|
||||
result = CliRunner().invoke(
|
||||
cli.cli,
|
||||
["insert", db_path, "data", file_path] + options,
|
||||
["insert", db_path, "data", file_path] + options + ["--no-detect-types"],
|
||||
catch_exceptions=False,
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
|
|
@ -236,7 +236,7 @@ def test_insert_csv_tsv(content, options, db_path, tmpdir):
|
|||
|
||||
@pytest.mark.parametrize("empty_null", (True, False))
|
||||
def test_insert_csv_empty_null(db_path, empty_null):
|
||||
options = ["--csv"]
|
||||
options = ["--csv", "--no-detect-types"]
|
||||
if empty_null:
|
||||
options.append("--empty-null")
|
||||
result = CliRunner().invoke(
|
||||
|
|
@ -430,7 +430,7 @@ def test_insert_text(db_path):
|
|||
"options,input",
|
||||
(
|
||||
([], '[{"id": "1", "name": "Bob"}, {"id": "2", "name": "Cat"}]'),
|
||||
(["--csv"], "id,name\n1,Bob\n2,Cat"),
|
||||
(["--csv", "--no-detect-types"], "id,name\n1,Bob\n2,Cat"),
|
||||
(["--nl"], '{"id": "1", "name": "Bob"}\n{"id": "2", "name": "Cat"}'),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ def test_sniff(tmpdir, filepath):
|
|||
runner = CliRunner()
|
||||
result = runner.invoke(
|
||||
cli.cli,
|
||||
["insert", db_path, "creatures", str(filepath), "--sniff"],
|
||||
["insert", db_path, "creatures", str(filepath), "--sniff", "--no-detect-types"],
|
||||
catch_exceptions=False,
|
||||
)
|
||||
assert result.exit_code == 0, result.stdout
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue