mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-27 04:14:30 +02:00
--no-skip-false option, plus docs - closes #527
This commit is contained in:
parent
455c35b512
commit
e0ec4c3451
4 changed files with 34 additions and 0 deletions
|
|
@ -626,3 +626,30 @@ def test_convert_initialization_pattern(fresh_db_and_path):
|
|||
assert list(db["names"].rows) == [
|
||||
{"id": 1, "name": "17"},
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"no_skip_false,expected",
|
||||
(
|
||||
(True, 1),
|
||||
(False, 0),
|
||||
),
|
||||
)
|
||||
def test_convert_no_skip_false(fresh_db_and_path, no_skip_false, expected):
|
||||
db, db_path = fresh_db_and_path
|
||||
args = [
|
||||
"convert",
|
||||
db_path,
|
||||
"t",
|
||||
"x",
|
||||
"-",
|
||||
]
|
||||
if no_skip_false:
|
||||
args.append("--no-skip-false")
|
||||
db["t"].insert_all([{"x": 0}, {"x": 1}])
|
||||
assert db["t"].get(1)["x"] == 0
|
||||
assert db["t"].get(2)["x"] == 1
|
||||
result = CliRunner().invoke(cli.cli, args, input="value + 1")
|
||||
assert 0 == result.exit_code, result.output
|
||||
assert db["t"].get(1)["x"] == expected
|
||||
assert db["t"].get(2)["x"] == 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue