diff --git a/mscxyz/cli.py b/mscxyz/cli.py index 200c08a..0659f97 100644 --- a/mscxyz/cli.py +++ b/mscxyz/cli.py @@ -714,6 +714,9 @@ def list_styles(version: int) -> None: # style + if args.style_clean: + score.style.clean() + for style_name, value in args.style_value: score.style.set(style_name, value) @@ -750,11 +753,6 @@ def list_styles(version: int) -> None: # print("\n" + utils.color(file, "red")) - # if args.subcommand == "clean": - # score = Score(file) - # print(score.filename) - # score.clean() - # elif args.subcommand == "lyrics": # score = Score(file) if args.lyrics_remap: diff --git a/tests/test_style.py b/tests/test_style.py index 646e9ab..870e70b 100644 --- a/tests/test_style.py +++ b/tests/test_style.py @@ -317,7 +317,8 @@ def test_method_set_all(styles: str) -> None: class TestClean: - def test_clean(self) -> None: + @pytest.mark.legacy + def test_clean_legacy(self) -> None: c = Cli("clean", legacy=True).append_score("formats.mscz").execute() uncleaned: str = c.pre.read_as_text() @@ -336,14 +337,41 @@ def test_clean(self) -> None: assert "" not in cleaned assert "" not in cleaned - def test_clean_add_style(self) -> None: + def test_clean(self) -> None: + c = Cli("--clean").append_score("formats.mscz").execute() + + uncleaned: str = c.pre.read_as_text() + assert "" in uncleaned + assert "" in uncleaned + # assert "" in uncleaned + assert "" in uncleaned + + cleaned: str = c.post.read_as_text() + assert "" not in cleaned + assert "" not in cleaned + assert "" not in cleaned + assert "" not in cleaned + + @pytest.mark.legacy + def test_clean_add_style_legacy(self) -> None: score = ( Cli("clean", "--style", helper.get_score("style.mss", 2), legacy=True) .append_score("simple.mscx", 2) .score() ) - style = score.read_as_text() - assert "77" in style + assert "77" in score.read_as_text() + + def test_clean_add_style(self) -> None: + score = ( + Cli("--clean", "--style-file", helper.get_file("Jazz.mss", 4)) + .append_score("score.mscz") + .score() + ) + assert "MuseJazz" in score.read_as_text() def test_load_style_file() -> None: