From 25d4cfee013b59845476d88a9b87a1f7904f44d9 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Mon, 13 Oct 2025 16:49:39 -0400 Subject: [PATCH 1/3] print info API and beginnings of test --- src/diffpy/cmi/cli.py | 11 +++++++++++ tests/test_cli.py | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/diffpy/cmi/cli.py b/src/diffpy/cmi/cli.py index dbd663c..3799a1c 100644 --- a/src/diffpy/cmi/cli.py +++ b/src/diffpy/cmi/cli.py @@ -25,6 +25,17 @@ from diffpy.cmi.profilesmanager import ProfilesManager +def print_info(pack_ex_dict: dict[str, List[Tuple[str, Path]]]) -> None: + """Print information about available examples and packs. + + Parameters + ---------- + pack_ex_dict : dict[str, List[Tuple[str, Path]]] + Dictionary mapping pack name -> list of (example name, example path). + """ + return + + def copy_examples( examples_dict: Dict[str, List[Tuple[str, Path]]], target_dir: Path = None ) -> None: diff --git a/tests/test_cli.py b/tests/test_cli.py index 9eb9712..27083ad 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -4,6 +4,29 @@ import pytest from diffpy.cmi import cli +from diffpy.cmi.packsmanager import PacksManager + + +@pytest.mark.parametrize( + "input,expected", + [ + ("case1", "captured output for case1"), + ("case2", "captured output for case2"), + ("case3", "captured output for case3"), + ("case4", "captured output for case4"), + ("case5", "captured output for case5"), + ], +) +def test_print_info(input, expected, example_cases, capsys): + case_dir = example_cases / input + pm = PacksManager(case_dir) + examples_dict = pm.available_examples() + cli.print_info(examples_dict) + # capture the outputs and compare to expected + captured = capsys.readouterr() + output = captured.out + assert output == expected + # assert False def test_map_pack_to_examples_structure(): From 8358f0277a224c8c8129d022901be989a3e2d36b Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Mon, 13 Oct 2025 16:49:50 -0400 Subject: [PATCH 2/3] news --- news/print-info.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/print-info.rst diff --git a/news/print-info.rst b/news/print-info.rst new file mode 100644 index 0000000..f773ba1 --- /dev/null +++ b/news/print-info.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* Changed the command for printing packs and examples. + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From 570641d4a3a6351b344293e3903c361dfde1a3a4 Mon Sep 17 00:00:00 2001 From: Caden Myers Date: Mon, 13 Oct 2025 16:50:37 -0400 Subject: [PATCH 3/3] rm comment --- tests/test_cli.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 27083ad..adf1479 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -22,11 +22,10 @@ def test_print_info(input, expected, example_cases, capsys): pm = PacksManager(case_dir) examples_dict = pm.available_examples() cli.print_info(examples_dict) - # capture the outputs and compare to expected captured = capsys.readouterr() output = captured.out assert output == expected - # assert False + assert False def test_map_pack_to_examples_structure():