def extract_todo(self, file: Path, content: str, expected: List[Tuple[Path, int, str]]): """Test 'extract_todos' function. Parameters ---------- file : pathlib.Path Test file path content : str Content of the test file expected : List List of expected todos """ self.fs.create_file(file, contents=content) todos = extract_todos(file) self.assertListEqual(todos, expected)
def test_go(self): """Test go-file.""" fpath = os.path.join(self.path, "test.go") corr = [(fpath, 5, "test"), (fpath, 7, "test 2")] todos = extract_todo.extract_todos(fpath) self.assertListEqual(todos, corr)
def test_cs(self): """Test cs-file.""" fpath = os.path.join(self.path, "test.cs") corr = [(fpath, 1, "test"), (fpath, 7, "test 2")] todos = extract_todo.extract_todos(fpath) self.assertListEqual(todos, corr)
def test_hpp(self): """Test hpp-file.""" fpath = os.path.join(self.path, "test.hpp") corr = [(fpath, 1, "test"), (fpath, 3, "test 2")] todos = extract_todo.extract_todos(fpath) self.assertListEqual(todos, corr)
def test_py(self): """Test py-file.""" fpath = os.path.join(self.path, "test.py") corr = [(fpath, 1, "test"), (fpath, 5, "test 2")] todos = extract_todo.extract_todos(fpath) self.assertListEqual(todos, corr)
def test_latex(self): """Test tex-file.""" fpath = os.path.join(self.path, "test.tex") corr = [(fpath, 2, "test"), (fpath, 3, "test 2")] todos = extract_todo.extract_todos(fpath) self.assertListEqual(todos, corr)
def test_java(self): """Test java-file.""" fpath = os.path.join(self.path, "test.java") corr = [(fpath, 1, "test"), (fpath, 4, "test 2")] todos = extract_todo.extract_todos(fpath) self.assertListEqual(todos, corr)