mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-04 23:46:14 +02:00
update tests with better verifications
make format space review feedbac
This commit is contained in:
parent
b8b56124ee
commit
6e09f93f16
5 changed files with 50 additions and 50 deletions
|
@ -2,7 +2,6 @@ import shlex
|
|||
import pytest
|
||||
import mock
|
||||
|
||||
import yaml
|
||||
|
||||
from jrnl.args import parse_args
|
||||
from jrnl.jrnl import run
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from features.steps.override import config_override
|
||||
import shlex
|
||||
|
||||
import pytest
|
||||
|
@ -6,6 +5,7 @@ import pytest
|
|||
from jrnl.args import parse_args
|
||||
from jrnl.args import deserialize_config_args
|
||||
|
||||
|
||||
def cli_as_dict(str):
|
||||
cli = shlex.split(str)
|
||||
args = parse_args(cli)
|
||||
|
@ -206,6 +206,7 @@ def test_version_alone():
|
|||
|
||||
assert cli_as_dict("--version") == expected_args(preconfig_cmd=preconfig_version)
|
||||
|
||||
|
||||
class TestDeserialization:
|
||||
@pytest.mark.parametrize(
|
||||
"input_str",
|
||||
|
@ -215,8 +216,7 @@ class TestDeserialization:
|
|||
'editor:"nano", colors.title:blue, default:"/tmp/eg\ g.txt"',
|
||||
],
|
||||
)
|
||||
def test_deserialize_multiword_strings(self,input_str):
|
||||
|
||||
def test_deserialize_multiword_strings(self, input_str):
|
||||
|
||||
runtime_config = deserialize_config_args(input_str)
|
||||
assert runtime_config.__class__ == dict
|
||||
|
@ -224,18 +224,19 @@ class TestDeserialization:
|
|||
assert "colors.title" in runtime_config.keys()
|
||||
assert "default" in runtime_config.keys()
|
||||
|
||||
def test_deserialize_int(self):
|
||||
input = 'linewrap: 23, default_hour: 19'
|
||||
def test_deserialize_int(self):
|
||||
input = "linewrap: 23, default_hour: 19"
|
||||
runtime_config = deserialize_config_args(input)
|
||||
assert runtime_config['linewrap'] == 23
|
||||
assert runtime_config['default_hour'] == 19
|
||||
assert runtime_config["linewrap"] == 23
|
||||
assert runtime_config["default_hour"] == 19
|
||||
|
||||
def test_deserialize_multiple_datatypes(self):
|
||||
def test_deserialize_multiple_datatypes(self):
|
||||
input = 'linewrap: 23, encrypt: false, editor:"vi -c startinsert"'
|
||||
cfg = deserialize_config_args(input)
|
||||
assert cfg['encrypt'] == False
|
||||
assert cfg['linewrap'] == 23
|
||||
assert cfg['editor'] == '"vi -c startinsert"'
|
||||
cfg = deserialize_config_args(input)
|
||||
assert cfg["encrypt"] == False
|
||||
assert cfg["linewrap"] == 23
|
||||
assert cfg["editor"] == '"vi -c startinsert"'
|
||||
|
||||
|
||||
def test_editor_override():
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue