File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 1717
1818
1919def check_file (path : Path , run_number : str ) -> bool :
20+ """
21+ Check if a file matches the run number.
22+
23+ :param path: The path to the file.
24+ :param run_number: The run number to check for.
25+ :return: True if it is a file and the run number is in the name.
26+ """
2027 return path .is_file () and run_number in path .name
2128
2229
2330def check_dir (path : Path , run_number : str ) -> Path | None :
31+ """
32+ Check a directory for the IMAT image structure.
33+
34+ This looks for a file containing the run number and a directory named 'Tomo'.
35+
36+ :param path: The path to the experiment directory.
37+ :param run_number: The run number to check for.
38+ :return: The path to the Tomo directory if found, otherwise None.
39+ """
2440 tomo = None
2541 file_found = False
2642 for child in path .iterdir ():
Original file line number Diff line number Diff line change 1010from rundetection .job_requests import JobRequest
1111from rundetection .rules .imat_rules import IMATFindImagesRule
1212
13+ EXPECTED_ADDITIONAL_VALUES_LEN = 2
14+ RUN_NUMBER = 100
15+
1316
1417@pytest .fixture
1518def job_request ():
@@ -50,9 +53,9 @@ def test_imat_find_images_success(job_request):
5053 rule .verify (job_request )
5154
5255 # Assertions
53- assert len (job_request .additional_values ) == 2
56+ assert len (job_request .additional_values ) == EXPECTED_ADDITIONAL_VALUES_LEN
5457 assert job_request .additional_values ["images_dir" ] == str (tomo_dir )
55- assert job_request .additional_values ["runno" ] == 100
58+ assert job_request .additional_values ["runno" ] == RUN_NUMBER
5659
5760
5861def test_imat_find_images_tomo_first (job_request ):
You can’t perform that action at this time.
0 commit comments