diff --git a/flepimop/gempyor_pkg/src/gempyor/cli.py b/flepimop/gempyor_pkg/src/gempyor/cli.py index bc71a8fe5..43bad34fc 100644 --- a/flepimop/gempyor_pkg/src/gempyor/cli.py +++ b/flepimop/gempyor_pkg/src/gempyor/cli.py @@ -21,19 +21,7 @@ # add some basic commands to the CLI -@cli.command( - params=[config_files_argument] - + list(config_file_options.values()) - + [ - click.Option( - ["--indent"], - type=click.IntRange(min=1), - required=False, - default=2, - help="Indentation level for the output YAML.", - ) - ], -) +@cli.command(params=[config_files_argument] + list(config_file_options.values())) @click.pass_context def patch(ctx: click.Context = mock_context, **kwargs) -> None: """Merge configuration files @@ -64,7 +52,7 @@ def patch(ctx: click.Context = mock_context, **kwargs) -> None: gamma: value: 5.6 EOF - $ flepimop patch config1.yml config2.yml --indent 4 + $ flepimop patch config1.yml config2.yml ...: UserWarning: Configuration files contain overlapping keys: {'seir'}. warnings.warn(f"Configuration files contain overlapping keys: {intersect}.") compartments: @@ -89,7 +77,7 @@ def patch(ctx: click.Context = mock_context, **kwargs) -> None: stoch_traj_flag: false write_csv: false write_parquet: true - $ flepimop patch config2.yml config1.yml --indent 4 + $ flepimop patch config2.yml config1.yml ...: UserWarning: Configuration files contain overlapping keys: {'seir'}. warnings.warn(f"Configuration files contain overlapping keys: {intersect}.") compartments: @@ -116,7 +104,7 @@ def patch(ctx: click.Context = mock_context, **kwargs) -> None: ``` """ parse_config_files(config, ctx, **kwargs) - print(yaml.dump(yaml.safe_load(config.dump()), indent=kwargs["indent"])) + print(yaml.dump(yaml.safe_load(config.dump()), indent=4)) if __name__ == "__main__": diff --git a/flepimop/gempyor_pkg/tests/cli/test_flepimop_patch_cli.py b/flepimop/gempyor_pkg/tests/cli/test_flepimop_patch_cli.py index 800fac3b1..72d0134b9 100644 --- a/flepimop/gempyor_pkg/tests/cli/test_flepimop_patch_cli.py +++ b/flepimop/gempyor_pkg/tests/cli/test_flepimop_patch_cli.py @@ -74,27 +74,3 @@ def test_patch_seir_parameters_behavior( patched_config = yaml.safe_load(result.output) assert "seir" in patched_config assert patched_config["seir"]["parameters"] == expected_parameters - - -@pytest.mark.parametrize("indent", (2, 4, 6)) -def test_user_provided_indent_size( - tmp_path: Path, monkeypatch: pytest.MonkeyPatch, indent: int -) -> None: - # Setup the test - monkeypatch.chdir(tmp_path) - config = tmp_path / "config.yml" - config.write_text(yaml.dump({"seir": {"parameters": {"beta": {"value": 1.2}}}})) - - # Invoke the command - runner = CliRunner() - result = runner.invoke(patch, [config.name, "--indent", str(indent)]) - assert result.exit_code == 0 - - # Check the output indentation, manually since `yaml.load` abstracts spacing away - for line in result.output.split(): - stripped_line = line.lstrip() - if stripped_line and not stripped_line.startswith("#"): - indent_size = len(line) - len(stripped_line) - if indent_size > 0: - assert indent_size == indent - break