Skip to content

Commit ce1aab2

Browse files
committed
Pass actual DF in tests
1 parent ced40e9 commit ce1aab2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/test_existing_images.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def setUp(self):
1717
def test_directory_does_not_exist(self, mock_exists):
1818
"""If image directory doesn't exist, all images marked as not in directory."""
1919
updated_df, filtered_df = check_existing_images(
20-
self.csv_path, self.img_dir, self.sample_df.copy(), self.filename_col
20+
self.csv_path, self.img_dir, self.sample_df, self.filename_col
2121
)
2222

2323
self.assertFalse(any(updated_df["in_img_dir"]))
@@ -30,7 +30,7 @@ def test_directory_does_not_exist(self, mock_exists):
3030
def test_some_files_exist(self, mock_print, mock_gather, mock_exists):
3131
"""Should mark existing files correctly and print status."""
3232
updated_df, filtered_df = check_existing_images(
33-
self.csv_path, self.img_dir, self.sample_df.copy(), self.filename_col
33+
self.csv_path, self.img_dir, self.sample_df, self.filename_col
3434
)
3535

3636
self.assertTrue(updated_df.loc[0, "in_img_dir"]) # a.jpg exists
@@ -46,7 +46,7 @@ def test_all_files_exist_exits(self, mock_gather, mock_exists):
4646
"""If all images exist, should exit early with proper message."""
4747
with self.assertRaises(SystemExit) as cm:
4848
check_existing_images(
49-
self.csv_path, self.img_dir, self.sample_df.copy(), self.filename_col
49+
self.csv_path, self.img_dir, self.sample_df, self.filename_col
5050
)
5151

5252
self.assertIn("already contains all images", cm.exception.code)
@@ -58,7 +58,7 @@ def test_all_files_exist_exits(self, mock_gather, mock_exists):
5858
def test_no_files_exist(self, mock_print, mock_gather, mock_exists):
5959
"""If no files exist, should mark all as missing and print message."""
6060
updated_df, filtered_df = check_existing_images(
61-
self.csv_path, self.img_dir, self.sample_df.copy(), self.filename_col
61+
self.csv_path, self.img_dir, self.sample_df, self.filename_col
6262
)
6363

6464
self.assertFalse(any(updated_df["in_img_dir"]))
@@ -76,7 +76,7 @@ def test_subfolders_handling(self, mock_gather, mock_exists):
7676
})
7777

7878
updated_df, filtered_df = check_existing_images(
79-
self.csv_path, self.img_dir, sub_df.copy(), self.filename_col, subfolders="subfolder"
79+
self.csv_path, self.img_dir, sub_df, self.filename_col, subfolders="subfolder"
8080
)
8181

8282
# species1/a.jpg should be marked present, species2/b.jpg missing

0 commit comments

Comments
 (0)