fixbug: unit test

This commit is contained in:
莘权 马 2024-01-11 23:15:18 +08:00
parent 251352e802
commit 1523a0df81
19 changed files with 152 additions and 82 deletions

View file

@ -78,12 +78,14 @@ class ResourceFileRepositories(FileRepository):
class ProjectRepo(FileRepository):
def __init__(self, root: str | Path = None, git_repo: GitRepository = None):
if not root and not git_repo:
raise ValueError("Invalid root and git_repo")
git_repo_ = git_repo or GitRepository(local_path=Path(root))
def __init__(self, root: str | Path | GitRepository):
if isinstance(root, str) or isinstance(root, Path):
git_repo_ = GitRepository(local_path=Path(root))
elif isinstance(root, GitRepository):
git_repo_ = root
else:
raise ValueError("Invalid root")
super().__init__(git_repo=git_repo_, relative_path=Path("."))
self._git_repo = git_repo_
self.docs = DocFileRepositories(self._git_repo)
self.resources = ResourceFileRepositories(self._git_repo)