mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-11-27 20:39:47 +01:00
--nl now ignores blank lines, closes #376
This commit is contained in:
parent
2f8879235a
commit
d2a79d200f
2 changed files with 2 additions and 2 deletions
|
|
@ -791,7 +791,7 @@ def insert_upsert_implementation(
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
if nl:
|
if nl:
|
||||||
docs = (json.loads(line) for line in decoded)
|
docs = (json.loads(line) for line in decoded if line.strip())
|
||||||
else:
|
else:
|
||||||
docs = json.load(decoded)
|
docs = json.load(decoded)
|
||||||
if isinstance(docs, dict):
|
if isinstance(docs, dict):
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ def test_insert_newline_delimited(db_path):
|
||||||
result = CliRunner().invoke(
|
result = CliRunner().invoke(
|
||||||
cli.cli,
|
cli.cli,
|
||||||
["insert", db_path, "from_json_nl", "-", "--nl"],
|
["insert", db_path, "from_json_nl", "-", "--nl"],
|
||||||
input='{"foo": "bar", "n": 1}\n{"foo": "baz", "n": 2}',
|
input='{"foo": "bar", "n": 1}\n\n{"foo": "baz", "n": 2}',
|
||||||
)
|
)
|
||||||
assert 0 == result.exit_code, result.output
|
assert 0 == result.exit_code, result.output
|
||||||
db = Database(db_path)
|
db = Database(db_path)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue