mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 18:04:32 +02:00
--raw option, refs #123
This commit is contained in:
parent
a236a6bc77
commit
bc8409941f
3 changed files with 35 additions and 2 deletions
|
|
@ -797,6 +797,21 @@ def test_query_json_with_json_cols(db_path):
|
|||
assert expected == result_rows.output.strip()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"content,is_binary",
|
||||
[(b"\x00\x0Fbinary", True), ("this is text", False), (1, False), (1.5, False)],
|
||||
)
|
||||
def test_query_raw(db_path, content, is_binary):
|
||||
Database(db_path)["files"].insert({"content": content})
|
||||
result = CliRunner().invoke(
|
||||
cli.cli, [db_path, "select content from files", "--raw"]
|
||||
)
|
||||
if is_binary:
|
||||
assert result.stdout_bytes == content
|
||||
else:
|
||||
assert result.output == str(content)
|
||||
|
||||
|
||||
def test_query_memory_does_not_create_file(tmpdir):
|
||||
owd = os.getcwd()
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue