Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9fa28ae

Browse files
committed
Add failing tests for joining paths
1 parent6d66a02 commit9fa28ae

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

‎test/test_tree.py‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
frompathlibimportPath
99
importsubprocess
1010

11+
importpytest
12+
1113
fromgit.objectsimportBlob,Tree
14+
fromgit.repoimportRepo
1215
fromgit.utilimportcwd
1316

1417
fromtest.libimportTestBase,with_rw_directory
18+
from .lib.helperimportPathLikeMock,with_rw_repo
1519

1620

1721
classTestTree(TestBase):
@@ -161,3 +165,57 @@ def lib_folder(t, _d):
161165
assertroot[item.path]==item==root/item.path
162166
# END for each item
163167
assertfound_slash
168+
169+
@with_rw_repo("0.3.2.1")
170+
deftest_repo_lookup_string_path(self,rw_repo):
171+
repo=Repo(rw_repo.git_dir)
172+
blob=repo.tree()/".gitignore"
173+
assertisinstance(blob,Blob)
174+
assertblob.hexsha=="787b3d442a113b78e343deb585ab5531eb7187fa"
175+
176+
@with_rw_repo("0.3.2.1")
177+
deftest_repo_lookup_pathlike_path(self,rw_repo):
178+
repo=Repo(rw_repo.git_dir)
179+
blob=repo.tree()/PathLikeMock(".gitignore")
180+
assertisinstance(blob,Blob)
181+
assertblob.hexsha=="787b3d442a113b78e343deb585ab5531eb7187fa"
182+
183+
@with_rw_repo("0.3.2.1")
184+
deftest_repo_lookup_invalid_string_path(self,rw_repo):
185+
repo=Repo(rw_repo.git_dir)
186+
withpytest.raises(KeyError):
187+
repo.tree()/"doesnotexist"
188+
189+
@with_rw_repo("0.3.2.1")
190+
deftest_repo_lookup_invalid_pathlike_path(self,rw_repo):
191+
repo=Repo(rw_repo.git_dir)
192+
withpytest.raises(KeyError):
193+
repo.tree()/PathLikeMock("doesnotexist")
194+
195+
@with_rw_repo("0.3.2.1")
196+
deftest_repo_lookup_nested_string_path(self,rw_repo):
197+
repo=Repo(rw_repo.git_dir)
198+
blob=repo.tree()/"git/__init__.py"
199+
assertisinstance(blob,Blob)
200+
assertblob.hexsha=="d87dcbdbb65d2782e14eea27e7f833a209c052f3"
201+
202+
@with_rw_repo("0.3.2.1")
203+
deftest_repo_lookup_nested_pathlike_path(self,rw_repo):
204+
repo=Repo(rw_repo.git_dir)
205+
blob=repo.tree()/PathLikeMock("git/__init__.py")
206+
assertisinstance(blob,Blob)
207+
assertblob.hexsha=="d87dcbdbb65d2782e14eea27e7f833a209c052f3"
208+
209+
@with_rw_repo("0.3.2.1")
210+
deftest_repo_lookup_folder_string_path(self,rw_repo):
211+
repo=Repo(rw_repo.git_dir)
212+
blob=repo.tree()/"git"
213+
assertisinstance(blob,Tree)
214+
assertblob.hexsha=="ec8ae429156d65afde4bbb3455570193b56f0977"
215+
216+
@with_rw_repo("0.3.2.1")
217+
deftest_repo_lookup_folder_pathlike_path(self,rw_repo):
218+
repo=Repo(rw_repo.git_dir)
219+
blob=repo.tree()/PathLikeMock("git")
220+
assertisinstance(blob,Tree)
221+
assertblob.hexsha=="ec8ae429156d65afde4bbb3455570193b56f0977"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp