66from muse2_data_analysis import helpers
77
88
9- @patch ("muse2_data_analysis.helpers.run_muse2" )
10- def test_get_example_input_dir_returns_existing_directory (
11- run_muse2_mock : Mock , tmp_path : Path
12- ) -> None :
13- """Check that get_example_input_dir returns an existing input directory."""
14- input_dir = tmp_path / "input"
15- input_dir .mkdir ()
16-
17- with patch .object (helpers , "_INPUT_DIR" , input_dir ):
18- assert helpers .get_example_input_dir () == input_dir
19-
20- run_muse2_mock .assert_not_called ()
21-
22-
23- @patch ("muse2_data_analysis.helpers.run_muse2" )
24- def test_get_example_input_dir_extracts_example_when_missing (
25- run_muse2_mock : Mock , tmp_path : Path
26- ) -> None :
27- """Check that get_example_input_dir extracts the example when missing."""
28- input_dir = tmp_path / "input"
29-
30- with patch .object (helpers , "_INPUT_DIR" , input_dir ):
31- assert helpers .get_example_input_dir () == input_dir
32-
33- run_muse2_mock .assert_called_once_with (
34- "example" , "extract" , helpers .EXAMPLE_NAME , str (input_dir )
35- )
36-
37-
389@patch ("muse2_data_analysis.helpers.run_muse2" )
3910def test_get_example_output_dir_returns_existing_directory (
4011 run_muse2_mock : Mock , tmp_path : Path
@@ -50,20 +21,15 @@ def test_get_example_output_dir_returns_existing_directory(
5021
5122
5223@patch ("muse2_data_analysis.helpers.run_muse2" )
53- @patch ("muse2_data_analysis.helpers.get_example_input_dir" )
5424def test_get_example_output_dir_runs_example_when_missing (
55- get_example_input_dir_mock : Mock , run_muse2_mock : Mock , tmp_path : Path
25+ run_muse2_mock : Mock , tmp_path : Path
5626) -> None :
57- """Check that get_example_output_dir ensures input exists and runs the model."""
58- input_dir = tmp_path / "input"
27+ """Check that get_example_output_dir runs the example when output is missing."""
5928 output_dir = tmp_path / "output"
60- get_example_input_dir_mock .return_value = input_dir
6129
62- with patch .object (helpers , "_INPUT_DIR" , input_dir ):
63- with patch .object (helpers , "_OUTPUT_DIR" , output_dir ):
64- assert helpers .get_example_output_dir () == output_dir
30+ with patch .object (helpers , "_OUTPUT_DIR" , output_dir ):
31+ assert helpers .get_example_output_dir () == output_dir
6532
66- get_example_input_dir_mock .assert_called_once_with ()
6733 run_muse2_mock .assert_called_once_with (
68- "run" , str ( input_dir ) , "--output-dir" , str (output_dir )
34+ "example" , " run" , helpers . EXAMPLE_NAME , "--output-dir" , str (output_dir )
6935 )
0 commit comments