search_file break up and test -- not working yet

This commit is contained in:
2024-06-25 23:57:24 -04:00
parent 5d4d459f07
commit 6a257c3a91
5 changed files with 79 additions and 1 deletions

22
test/test_search_file.py Normal file
View File

@@ -0,0 +1,22 @@
import unittest
from search_file import search_file
# TODO: gros TODO icitte. Presque rien de fait!
class TestSearchFile(unittest.TestCase):
data_dir = "test/data/search_test"
def test_print_num_list(self):
p = [""]
def test_search_file(self):
print(search_file("match1.txt", self.data_dir))
with self.assertRaises(FileNotFoundError) as e:
search_file("inexistent.txt", self.data_dir)
self.assertTrue("File does not exist", e.exception)
self.assertEqual(search_file("with space.txt", self.data_dir), "test/data/search_test/subdir2/with space.txt")
print(search_file("match2.txt", self.data_dir))
print(search_file("subdir2", self.data_dir))