mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-08-03 07:54:22 +02:00
--raw-lines option, closes #539
This commit is contained in:
parent
8f9a729e8a
commit
373b7886d2
4 changed files with 70 additions and 3 deletions
|
|
@ -916,6 +916,21 @@ def test_query_raw(db_path, content, is_binary):
|
|||
assert result.output == str(content)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"content,is_binary",
|
||||
[(b"\x00\x0Fbinary", True), ("this is text", False), (1, False), (1.5, False)],
|
||||
)
|
||||
def test_query_raw_lines(db_path, content, is_binary):
|
||||
Database(db_path)["files"].insert_all({"content": content} for _ in range(3))
|
||||
result = CliRunner().invoke(
|
||||
cli.cli, [db_path, "select content from files", "--raw-lines"]
|
||||
)
|
||||
if is_binary:
|
||||
assert result.stdout_bytes == b"\n".join(content for _ in range(3)) + b"\n"
|
||||
else:
|
||||
assert result.output == "\n".join(str(content) for _ in range(3)) + "\n"
|
||||
|
||||
|
||||
def test_query_memory_does_not_create_file(tmpdir):
|
||||
owd = os.getcwd()
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue