mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-06 08:26:12 +02:00
Resolve all remaining ruff line length errors
This commit is contained in:
parent
ece44c79a3
commit
71e1b38aff
18 changed files with 83 additions and 56 deletions
|
@ -38,38 +38,41 @@ def output_should_match(regex, cli_run):
|
|||
assert matches, f"\nRegex didn't match:\n{regex}\n{str(out)}\n{str(matches)}"
|
||||
|
||||
|
||||
@then(parse("the output {it_should:Should} contain\n{expected_output}", SHOULD_DICT))
|
||||
@then(parse('the output {it_should:Should} contain "{expected_output}"', SHOULD_DICT))
|
||||
@then(parse("the output {it_should:Should} contain\n{expected}", SHOULD_DICT))
|
||||
@then(parse('the output {it_should:Should} contain "{expected}"', SHOULD_DICT))
|
||||
@then(
|
||||
parse(
|
||||
"the {which_output_stream} output {it_should:Should} contain\n{expected_output}",
|
||||
"the {which_output_stream} output {it_should:Should} contain\n{expected}",
|
||||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
@then(
|
||||
parse(
|
||||
'the {which_output_stream} output {it_should:Should} contain "{expected_output}"',
|
||||
'the {which_output_stream} output {it_should:Should} contain "{expected}"',
|
||||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
def output_should_contain(expected_output, which_output_stream, cli_run, it_should):
|
||||
output_str = f"\nEXPECTED:\n{expected_output}\n\nACTUAL STDOUT:\n{cli_run['stdout']}\n\nACTUAL STDERR:\n{cli_run['stderr']}"
|
||||
assert expected_output
|
||||
def output_should_contain(expected, which_output_stream, cli_run, it_should):
|
||||
output_str = (
|
||||
f"\nEXPECTED:\n{expected}\n\n"
|
||||
f"ACTUAL STDOUT:\n{cli_run['stdout']}\n\n"
|
||||
f"ACTUAL STDERR:\n{cli_run['stderr']}"
|
||||
)
|
||||
|
||||
assert expected
|
||||
if which_output_stream is None:
|
||||
assert ((expected_output in cli_run["stdout"]) == it_should) or (
|
||||
(expected_output in cli_run["stderr"]) == it_should
|
||||
assert ((expected in cli_run["stdout"]) == it_should) or (
|
||||
(expected in cli_run["stderr"]) == it_should
|
||||
), output_str
|
||||
|
||||
elif which_output_stream == "standard":
|
||||
assert (expected_output in cli_run["stdout"]) == it_should, output_str
|
||||
assert (expected in cli_run["stdout"]) == it_should, output_str
|
||||
|
||||
elif which_output_stream == "error":
|
||||
assert (expected_output in cli_run["stderr"]) == it_should, output_str
|
||||
assert (expected in cli_run["stderr"]) == it_should, output_str
|
||||
|
||||
else:
|
||||
assert (
|
||||
expected_output in cli_run[which_output_stream]
|
||||
) == it_should, output_str
|
||||
assert (expected in cli_run[which_output_stream]) == it_should, output_str
|
||||
|
||||
|
||||
@then(parse("the output should not contain\n{expected_output}"))
|
||||
|
@ -119,7 +122,8 @@ def output_should_be_columns_wide(cli_run, width):
|
|||
|
||||
@then(
|
||||
parse(
|
||||
'the default journal "{journal_file}" should be in the "{journal_dir}" directory'
|
||||
'the default journal "{journal_file}" '
|
||||
'should be in the "{journal_dir}" directory'
|
||||
)
|
||||
)
|
||||
def default_journal_location(journal_file, journal_dir, config_on_disk, temp_dir):
|
||||
|
@ -135,13 +139,15 @@ def default_journal_location(journal_file, journal_dir, config_on_disk, temp_dir
|
|||
|
||||
@then(
|
||||
parse(
|
||||
'the config for journal "{journal_name}" {it_should:Should} contain "{some_yaml}"',
|
||||
'the config for journal "{journal_name}" '
|
||||
'{it_should:Should} contain "{some_yaml}"',
|
||||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
@then(
|
||||
parse(
|
||||
'the config for journal "{journal_name}" {it_should:Should} contain\n{some_yaml}',
|
||||
'the config for journal "{journal_name}" '
|
||||
"{it_should:Should} contain\n{some_yaml}",
|
||||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
|
@ -164,13 +170,15 @@ def config_var_on_disk(config_on_disk, journal_name, it_should, some_yaml):
|
|||
|
||||
@then(
|
||||
parse(
|
||||
'the config in memory for journal "{journal_name}" {it_should:Should} contain "{some_yaml}"',
|
||||
'the config in memory for journal "{journal_name}" '
|
||||
'{it_should:Should} contain "{some_yaml}"',
|
||||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
@then(
|
||||
parse(
|
||||
'the config in memory for journal "{journal_name}" {it_should:Should} contain\n{some_yaml}',
|
||||
'the config in memory for journal "{journal_name}" '
|
||||
"{it_should:Should} contain\n{some_yaml}",
|
||||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
|
|
|
@ -242,7 +242,9 @@ def test_color_override():
|
|||
|
||||
def test_multiple_overrides():
|
||||
parsed_args = cli_as_dict(
|
||||
'--config-override colors.title green --config-override editor "nano" --config-override journal.scratchpad "/tmp/scratchpad"'
|
||||
"--config-override colors.title green "
|
||||
'--config-override editor "nano" '
|
||||
'--config-override journal.scratchpad "/tmp/scratchpad"'
|
||||
)
|
||||
assert parsed_args == expected_args(
|
||||
config_override=[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue