Skip to content

Commit 1875885

Browse files
committed
Fix test cases
1 parent c042f56 commit 1875885

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

git/test/test_diff.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
Repo,
2222
GitCommandError,
2323
Diff,
24-
DiffIndex
24+
DiffIndex,
25+
NULL_TREE,
2526
)
2627

2728

@@ -132,13 +133,13 @@ def test_diff_initial_commit(self):
132133
initial_commit = self.rorepo.commit('33ebe7acec14b25c5f84f35a664803fcab2f7781')
133134

134135
# Without creating a patch...
135-
diff_index = initial_commit.diff('root')
136+
diff_index = initial_commit.diff(NULL_TREE)
136137
assert diff_index[0].b_path == 'CHANGES'
137138
assert diff_index[0].new_file
138139
assert diff_index[0].diff == ''
139140

140141
# ...and with creating a patch
141-
diff_index = initial_commit.diff('root', create_patch=True)
142+
diff_index = initial_commit.diff(NULL_TREE, create_patch=True)
142143
assert diff_index[0].b_path == 'CHANGES'
143144
assert diff_index[0].new_file
144145
assert diff_index[0].diff == fixture('diff_initial')
@@ -164,7 +165,7 @@ def test_diff_interface(self):
164165
diff_item = commit.tree
165166
# END use tree every second item
166167

167-
for other in (None, 'root', commit.Index, commit.parents[0]):
168+
for other in (None, NULL_TREE, commit.Index, commit.parents[0]):
168169
for paths in (None, "CHANGES", ("CHANGES", "lib")):
169170
for create_patch in range(2):
170171
diff_index = diff_item.diff(other=other, paths=paths, create_patch=create_patch)

0 commit comments

Comments
 (0)