search_file break up and test -- not working yet
This commit is contained in:
@@ -3,7 +3,7 @@ import os
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
class TestFixLinker(unittest.TestCase):
|
||||
class TestLinkFixer(unittest.TestCase):
|
||||
|
||||
tgt_dir = Path("test/data/tgt_dir")
|
||||
lnk_dir = Path("test/data/lnk_dir")
|
||||
@@ -69,5 +69,9 @@ class TestFixLinker(unittest.TestCase):
|
||||
link_fixer(self.tgt_file, self.tgt_dir)
|
||||
self.assertEqual(err.exception.code, self.ln_ns_error)
|
||||
|
||||
print("Test for inexistent ")
|
||||
with self.assertRaises(SystemExit) as err:
|
||||
link
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
22
test/test_search_file.py
Normal file
22
test/test_search_file.py
Normal 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))
|
||||
|
||||
Reference in New Issue
Block a user