Skip to content

Commit 733a674

Browse files
committed
Test for CSV headers with memory command, refs #702, #707
1 parent 2b0cc04 commit 733a674

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/test_cli_memory.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,24 @@ def test_memory_csv_encoding(tmpdir, use_stdin):
156156
}
157157

158158

159+
def test_memory_csv_headers_only(tmpdir):
160+
csv_path = str(tmpdir / "headers_only.csv")
161+
with open(csv_path, "w") as fp:
162+
fp.write("id,name,age\n")
163+
164+
result = CliRunner().invoke(
165+
cli.cli,
166+
["memory", csv_path, "", "--schema"],
167+
catch_exceptions=False,
168+
)
169+
170+
assert result.exit_code == 0
171+
assert result.output.strip() == (
172+
'CREATE VIEW "t1" AS select * from "headers_only";\n'
173+
'CREATE VIEW "t" AS select * from "headers_only";'
174+
)
175+
176+
159177
@pytest.mark.parametrize("extra_args", ([], ["select 1"]))
160178
def test_memory_dump(extra_args):
161179
result = CliRunner().invoke(

0 commit comments

Comments
 (0)