Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 93e1979

Browse files
committed
fixed the tests, which where broken before my commit, although the bug didn't reveal it...
1 parent a0d828f commit 93e1979

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

test/git/test_commit.py

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ def setup(self):
88
@patch(Git, 'method_missing')
99
def test_bake(self, git):
1010
git.return_value = fixture('rev_list_single')
11-
11+
1212
commit = Commit(self.repo, **{'id': '4c8124ffcf4039d292442eeccabdeca5af5c5017'})
1313
commit.author # bake
14-
14+
1515
assert_equal("Tom Preston-Werner", commit.author.name)
1616
assert_equal("[email protected]", commit.author.email)
17-
17+
1818
assert_true(git.called)
1919
assert_equal(git.call_args, (('rev_list', '4c8124ffcf4039d292442eeccabdeca5af5c5017'), {'pretty': 'raw', 'max_count': 1}))
2020

@@ -26,11 +26,11 @@ def test_id_abbrev(self, git):
2626
@patch(Git, 'method_missing')
2727
def test_diff(self, git):
2828
git.return_value = fixture('diff_p')
29-
29+
3030
diffs = Commit.diff(self.repo, 'master')
31-
31+
3232
assert_equal(15, len(diffs))
33-
33+
3434
assert_equal('.gitignore', diffs[0].a_path)
3535
assert_equal('.gitignore', diffs[0].b_path)
3636
assert_equal('4ebc8aea50e0a67e000ba29a30809d0a7b9b2666', diffs[0].a_commit.id)
@@ -39,7 +39,7 @@ def test_diff(self, git):
3939
assert_equal(False, diffs[0].new_file)
4040
assert_equal(False, diffs[0].deleted_file)
4141
assert_equal("--- a/.gitignore\n+++ b/.gitignore\n@@ -1 +1,2 @@\n coverage\n+pkg", diffs[0].diff)
42-
42+
4343
assert_equal('lib/grit/actor.rb', diffs[5].a_path)
4444
assert_equal(None, diffs[5].a_commit)
4545
assert_equal('f733bce6b57c0e5e353206e692b0e3105c2527f4', diffs[5].b_commit.id)
@@ -51,47 +51,47 @@ def test_diff(self, git):
5151
@patch(Git, 'method_missing')
5252
def test_diff_with_two_commits(self, git):
5353
git.return_value = fixture('diff_2')
54-
54+
5555
diffs = Commit.diff(self.repo, '59ddc32', '13d27d5')
56-
56+
5757
assert_equal(3, len(diffs))
58-
58+
5959
assert_true(git.called)
60-
assert_equal(git.call_args, (('diff', '59ddc32', '13d27d5', '--', 'master'), {'full_index': True}))
60+
assert_equal(git.call_args, (('diff', '59ddc32', '13d27d5'), {'full_index': True}))
6161

62-
@patch(Git, 'method_missing')
62+
@patch(Git, 'method_missing')
6363
def test_diff_with_files(self, git):
6464
git.return_value = fixture('diff_f')
65-
65+
6666
diffs = Commit.diff(self.repo, '59ddc32', ['lib'])
67-
67+
6868
assert_equal(1, len(diffs))
6969
assert_equal('lib/grit/diff.rb', diffs[0].a_path)
70-
70+
7171
assert_true(git.called)
7272
assert_equal(git.call_args, (('diff', '59ddc32', '--', 'lib'), {'full_index': True}))
73-
74-
@patch(Git, 'method_missing')
73+
74+
@patch(Git, 'method_missing')
7575
def test_diff_with_two_commits_and_files(self, git):
7676
git.return_value = fixture('diff_2f')
77-
77+
7878
diffs = Commit.diff(self.repo, '59ddc32', '13d27d5', ['lib'])
79-
79+
8080
assert_equal(1, len(diffs))
8181
assert_equal('lib/grit/commit.rb', diffs[0].a_path)
82-
82+
8383
assert_true(git.called)
8484
assert_equal(git.call_args, (('diff', '59ddc32', '13d27d5', '--', 'lib'), {'full_index': True}))
8585

8686
@patch(Git, 'method_missing')
8787
def test_diffs(self, git):
8888
git.return_value = fixture('diff_p')
89-
89+
9090
commit = Commit(self.repo, id='91169e1f5fa4de2eaea3f176461f5dc784796769', parents=['038af8c329ef7c1bae4568b98bd5c58510465493'])
9191
diffs = commit.diffs
92-
92+
9393
assert_equal(15, len(diffs))
94-
94+
9595
assert_equal('.gitignore', diffs[0].a_path)
9696
assert_equal('.gitignore', diffs[0].b_path)
9797
assert_equal('4ebc8aea50e0a67e000ba29a30809d0a7b9b2666', diffs[0].a_commit.id)
@@ -100,27 +100,27 @@ def test_diffs(self, git):
100100
assert_equal(False, diffs[0].new_file)
101101
assert_equal(False, diffs[0].deleted_file)
102102
assert_equal("--- a/.gitignore\n+++ b/.gitignore\n@@ -1 +1,2 @@\n coverage\n+pkg", diffs[0].diff)
103-
103+
104104
assert_equal('lib/grit/actor.rb', diffs[5].a_path)
105105
assert_equal(None, diffs[5].a_commit)
106106
assert_equal('f733bce6b57c0e5e353206e692b0e3105c2527f4', diffs[5].b_commit.id)
107107
assert_equal(True, diffs[5].new_file)
108-
108+
109109
assert_true(git.called)
110-
assert_equal(git.call_args, (('diff', '038af8c329ef7c1bae4568b98bd5c58510465493',
111-
'91169e1f5fa4de2eaea3f176461f5dc784796769',
112-
'--', '59ddc32', '13d27d5', '--', 'master'), {'full_index': True}))
110+
assert_equal(git.call_args, (('diff', '038af8c329ef7c1bae4568b98bd5c58510465493',
111+
'91169e1f5fa4de2eaea3f176461f5dc784796769',
112+
), {'full_index': True}))
113113

114-
@patch(Git, 'method_missing')
114+
@patch(Git, 'method_missing')
115115
def test_diffs_on_initial_import(self, git):
116116
git.return_value = fixture('diff_i')
117-
117+
118118
commit = Commit(self.repo, id='634396b2f541a9f2d58b00be1a07f0c358b999b3')
119119
commit.__bake_it__()
120120
diffs = commit.diffs
121-
121+
122122
assert_equal(10, len(diffs))
123-
123+
124124
assert_equal('History.txt', diffs[0].a_path)
125125
assert_equal('History.txt', diffs[0].b_path)
126126
assert_equal(None, diffs[0].a_commit)
@@ -129,61 +129,61 @@ def test_diffs_on_initial_import(self, git):
129129
assert_equal(True, diffs[0].new_file)
130130
assert_equal(False, diffs[0].deleted_file)
131131
assert_equal("--- /dev/null\n+++ b/History.txt\n@@ -0,0 +1,5 @@\n+== 1.0.0 / 2007-10-09\n+\n+* 1 major enhancement\n+ * Birthday!\n+", diffs[0].diff)
132-
132+
133133
assert_equal('lib/grit.rb', diffs[5].a_path)
134134
assert_equal(None, diffs[5].a_commit)
135135
assert_equal('32cec87d1e78946a827ddf6a8776be4d81dcf1d1', diffs[5].b_commit.id)
136136
assert_equal(True, diffs[5].new_file)
137-
137+
138138
assert_true(git.called)
139139
assert_equal(git.call_args, (('show', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'full_index': True, 'pretty': 'raw'}))
140-
141-
@patch(Git, 'method_missing')
140+
141+
@patch(Git, 'method_missing')
142142
def test_diffs_on_initial_import_with_empty_commit(self, git):
143143
git.return_value = fixture('show_empty_commit')
144-
144+
145145
commit = Commit(self.repo, id='634396b2f541a9f2d58b00be1a07f0c358b999b3')
146146
diffs = commit.diffs
147-
147+
148148
assert_equal([], diffs)
149-
149+
150150
assert_true(git.called)
151151
assert_equal(git.call_args, (('show', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'full_index': True, 'pretty': 'raw'}))
152-
153-
@patch(Git, 'method_missing')
152+
153+
@patch(Git, 'method_missing')
154154
def test_diffs_with_mode_only_change(self, git):
155155
git.return_value = fixture('diff_mode_only')
156-
156+
157157
commit = Commit(self.repo, id='91169e1f5fa4de2eaea3f176461f5dc784796769')
158158
commit.__bake_it__()
159159
diffs = commit.diffs
160-
160+
161161
assert_equal(23, len(diffs))
162162
assert_equal('100644', diffs[0].a_mode)
163163
assert_equal('100755', diffs[0].b_mode)
164-
164+
165165
assert_true(git.called)
166166
assert_equal(git.call_args, (('show', '91169e1f5fa4de2eaea3f176461f5dc784796769'), {'full_index': True, 'pretty': 'raw'}))
167167

168-
@patch(Git, 'method_missing')
168+
@patch(Git, 'method_missing')
169169
def test_stats(self, git):
170170
git.return_value = fixture('diff_numstat')
171-
171+
172172
commit = Commit(self.repo, id='634396b2f541a9f2d58b00be1a07f0c358b999b3')
173173
commit.__bake_it__()
174174
stats = commit.stats
175-
175+
176176
keys = stats.files.keys()
177177
keys.sort()
178178
assert_equal(["a.txt", "b.txt"], keys)
179-
179+
180180
assert_true(git.called)
181181
assert_equal(git.call_args, (('diff', '634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'numstat': True}))
182-
182+
183183
def test_str(self):
184184
commit = Commit(self.repo, id='abc')
185185
assert_equal ("abc", str(commit))
186-
186+
187187
def test_repr(self):
188188
commit = Commit(self.repo, id='abc')
189189
assert_equal('<GitPython.Commit "abc">', repr(commit))

0 commit comments

Comments
 (0)