@@ -61,14 +61,14 @@ def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False)
6161 stream .seek (0 )
6262
6363 istream = rwrepo .odb .store (IStream (Commit .type , streamlen , stream ))
64- assert istream .hexsha == cm .hexsha .encode ('ascii' )
64+ assert_equal ( istream .hexsha , cm .hexsha .encode ('ascii' ) )
6565
6666 nc = Commit (rwrepo , Commit .NULL_BIN_SHA , cm .tree ,
6767 cm .author , cm .authored_date , cm .author_tz_offset ,
6868 cm .committer , cm .committed_date , cm .committer_tz_offset ,
6969 cm .message , cm .parents , cm .encoding )
7070
71- assert nc .parents == cm .parents
71+ assert_equal ( nc .parents , cm .parents )
7272 stream = BytesIO ()
7373 nc ._serialize (stream )
7474 ns += 1
@@ -82,7 +82,7 @@ def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False)
8282 nc .binsha = rwrepo .odb .store (istream ).binsha
8383
8484 # if it worked, we have exactly the same contents !
85- assert nc .hexsha == cm .hexsha
85+ assert_equal ( nc .hexsha , cm .hexsha )
8686 # END check commits
8787 elapsed = time .time () - st
8888
@@ -103,10 +103,10 @@ def test_bake(self):
103103
104104 assert_equal ("Sebastian Thiel" , commit .author .name )
105105 assert_equal ("byronimo@gmail.com" , commit .author .email )
106- assert commit .author == commit .committer
106+ self . assertEqual ( commit .author , commit .committer )
107107 assert isinstance (commit .authored_date , int ) and isinstance (commit .committed_date , int )
108108 assert isinstance (commit .author_tz_offset , int ) and isinstance (commit .committer_tz_offset , int )
109- assert commit .message == "Added missing information to docstrings of commit and stats module\n "
109+ self . assertEqual ( commit .message , "Added missing information to docstrings of commit and stats module\n " )
110110
111111 def test_stats (self ):
112112 commit = self .rorepo .commit ('33ebe7acec14b25c5f84f35a664803fcab2f7781' )
@@ -129,20 +129,20 @@ def check_entries(d):
129129
130130 # assure data is parsed properly
131131 michael = Actor ._from_string ("Michael Trier <mtrier@gmail.com>" )
132- assert commit .author == michael
133- assert commit .committer == michael
134- assert commit .authored_date == 1210193388
135- assert commit .committed_date == 1210193388
136- assert commit .author_tz_offset == 14400 , commit .author_tz_offset
137- assert commit .committer_tz_offset == 14400 , commit .committer_tz_offset
138- assert commit .message == "initial project\n "
132+ self . assertEqual ( commit .author , michael )
133+ self . assertEqual ( commit .committer , michael )
134+ self . assertEqual ( commit .authored_date , 1210193388 )
135+ self . assertEqual ( commit .committed_date , 1210193388 )
136+ self . assertEqual ( commit .author_tz_offset , 14400 , commit .author_tz_offset )
137+ self . assertEqual ( commit .committer_tz_offset , 14400 , commit .committer_tz_offset )
138+ self . assertEqual ( commit .message , "initial project\n " )
139139
140140 def test_unicode_actor (self ):
141141 # assure we can parse unicode actors correctly
142142 name = u"Üäöß ÄußÉ"
143- assert len (name ) == 9
143+ self . assertEqual ( len (name ), 9 )
144144 special = Actor ._from_string (u"%s <something@this.com>" % name )
145- assert special .name == name
145+ self . assertEqual ( special .name , name )
146146 assert isinstance (special .name , text_type )
147147
148148 def test_traversal (self ):
@@ -156,44 +156,44 @@ def test_traversal(self):
156156 # basic branch first, depth first
157157 dfirst = start .traverse (branch_first = False )
158158 bfirst = start .traverse (branch_first = True )
159- assert next (dfirst ) == p0
160- assert next (dfirst ) == p00
159+ self . assertEqual ( next (dfirst ), p0 )
160+ self . assertEqual ( next (dfirst ), p00 )
161161
162- assert next (bfirst ) == p0
163- assert next (bfirst ) == p1
164- assert next (bfirst ) == p00
165- assert next (bfirst ) == p10
162+ self . assertEqual ( next (bfirst ), p0 )
163+ self . assertEqual ( next (bfirst ), p1 )
164+ self . assertEqual ( next (bfirst ), p00 )
165+ self . assertEqual ( next (bfirst ), p10 )
166166
167167 # at some point, both iterations should stop
168- assert list (bfirst )[- 1 ] == first
168+ self . assertEqual ( list (bfirst )[- 1 ], first )
169169 stoptraverse = self .rorepo .commit ("254d04aa3180eb8b8daf7b7ff25f010cd69b4e7d" ).traverse (as_edge = True )
170170 l = list (stoptraverse )
171- assert len (l [0 ]) == 2
171+ self . assertEqual ( len (l [0 ]), 2 )
172172
173173 # ignore self
174- assert next (start .traverse (ignore_self = False )) == start
174+ self . assertEqual ( next (start .traverse (ignore_self = False )), start )
175175
176176 # depth
177- assert len (list (start .traverse (ignore_self = False , depth = 0 ))) == 1
177+ self . assertEqual ( len (list (start .traverse (ignore_self = False , depth = 0 ))), 1 )
178178
179179 # prune
180- assert next (start .traverse (branch_first = 1 , prune = lambda i , d : i == p0 )) == p1
180+ self . assertEqual ( next (start .traverse (branch_first = 1 , prune = lambda i , d : i == p0 )), p1 )
181181
182182 # predicate
183- assert next (start .traverse (branch_first = 1 , predicate = lambda i , d : i == p1 )) == p1
183+ self . assertEqual ( next (start .traverse (branch_first = 1 , predicate = lambda i , d : i == p1 )), p1 )
184184
185185 # traversal should stop when the beginning is reached
186186 self .failUnlessRaises (StopIteration , next , first .traverse ())
187187
188188 # parents of the first commit should be empty ( as the only parent has a null
189189 # sha )
190- assert len (first .parents ) == 0
190+ self . assertEqual ( len (first .parents ), 0 )
191191
192192 def test_iteration (self ):
193193 # we can iterate commits
194194 all_commits = Commit .list_items (self .rorepo , self .rorepo .head )
195195 assert all_commits
196- assert all_commits == list (self .rorepo .iter_commits ())
196+ self . assertEqual ( all_commits , list (self .rorepo .iter_commits () ))
197197
198198 # this includes merge commits
199199 mcomit = self .rorepo .commit ('d884adc80c80300b4cc05321494713904ef1df2d' )
@@ -240,7 +240,7 @@ def test_ambiguous_arg_iteration(self, rw_dir):
240240 list (rw_repo .iter_commits (rw_repo .head .ref )) # should fail unless bug is fixed
241241
242242 def test_count (self ):
243- assert self .rorepo .tag ('refs/tags/0.1.5' ).commit .count () == 143
243+ self .assertEqual ( self . rorepo .tag ('refs/tags/0.1.5' ).commit .count (), 143 )
244244
245245 def test_list (self ):
246246 # This doesn't work anymore, as we will either attempt getattr with bytes, or compare 20 byte string
@@ -270,7 +270,7 @@ def test_iter_parents(self):
270270 piter = c .iter_parents (skip = skip )
271271 first_parent = next (piter )
272272 assert first_parent != c
273- assert first_parent == c .parents [0 ]
273+ self . assertEqual ( first_parent , c .parents [0 ])
274274 # END for each
275275
276276 def test_name_rev (self ):
@@ -283,7 +283,7 @@ def test_serialization(self, rwrepo):
283283 assert_commit_serialization (rwrepo , '0.1.6' )
284284
285285 def test_serialization_unicode_support (self ):
286- assert Commit .default_encoding .lower () == 'utf-8'
286+ self . assertEqual ( Commit .default_encoding .lower (), 'utf-8' )
287287
288288 # create a commit with unicode in the message, and the author's name
289289 # Verify its serialization and deserialization
@@ -292,10 +292,10 @@ def test_serialization_unicode_support(self):
292292 assert isinstance (cmt .author .name , text_type ) # same here
293293
294294 cmt .message = u"üäêèß"
295- assert len (cmt .message ) == 5
295+ self . assertEqual ( len (cmt .message ), 5 )
296296
297297 cmt .author .name = u"äüß"
298- assert len (cmt .author .name ) == 3
298+ self . assertEqual ( len (cmt .author .name ), 3 )
299299
300300 cstream = BytesIO ()
301301 cmt ._serialize (cstream )
@@ -305,8 +305,8 @@ def test_serialization_unicode_support(self):
305305 ncmt = Commit (self .rorepo , cmt .binsha )
306306 ncmt ._deserialize (cstream )
307307
308- assert cmt .author .name == ncmt .author .name
309- assert cmt .message == ncmt .message
308+ self . assertEqual ( cmt .author .name , ncmt .author .name )
309+ self . assertEqual ( cmt .message , ncmt .message )
310310 # actually, it can't be printed in a shell as repr wants to have ascii only
311311 # it appears
312312 cmt .author .__repr__ ()
@@ -315,8 +315,8 @@ def test_invalid_commit(self):
315315 cmt = self .rorepo .commit ()
316316 cmt ._deserialize (open (fixture_path ('commit_invalid_data' ), 'rb' ))
317317
318- assert cmt .author .name == u'E.Azer Ko�o�o�oculu' , cmt .author .name
319- assert cmt .author .email == 'azer@kodfabrik.com' , cmt .author .email
318+ self . assertEqual ( cmt .author .name , u'E.Azer Ko�o�o�oculu' , cmt .author .name )
319+ self . assertEqual ( cmt .author .email , 'azer@kodfabrik.com' , cmt .author .email )
320320
321321 def test_gpgsig (self ):
322322 cmt = self .rorepo .commit ()
@@ -339,7 +339,7 @@ def test_gpgsig(self):
339339JzJMZDRLQLFvnzqZuCjE
340340=przd
341341-----END PGP SIGNATURE-----"""
342- assert cmt .gpgsig == fixture_sig
342+ self . assertEqual ( cmt .gpgsig , fixture_sig )
343343
344344 cmt .gpgsig = "<test\n dummy\n sig>"
345345 assert cmt .gpgsig != fixture_sig
@@ -353,7 +353,7 @@ def test_gpgsig(self):
353353 cstream .seek (0 )
354354 cmt .gpgsig = None
355355 cmt ._deserialize (cstream )
356- assert cmt .gpgsig == "<test\n dummy\n sig>"
356+ self . assertEqual ( cmt .gpgsig , "<test\n dummy\n sig>" )
357357
358358 cmt .gpgsig = None
359359 cstream = BytesIO ()
@@ -387,9 +387,13 @@ def stream(self, *args):
387387
388388 def test_datetimes (self ):
389389 commit = self .rorepo .commit ('4251bd5' )
390- assert commit .authored_date == 1255018625
391- assert commit .committed_date == 1255026171
392- assert commit .authored_datetime == datetime (2009 , 10 , 8 , 18 , 17 , 5 , tzinfo = tzoffset (- 7200 )), commit .authored_datetime # noqa
393- assert commit .authored_datetime == datetime (2009 , 10 , 8 , 16 , 17 , 5 , tzinfo = utc ), commit .authored_datetime
394- assert commit .committed_datetime == datetime (2009 , 10 , 8 , 20 , 22 , 51 , tzinfo = tzoffset (- 7200 ))
395- assert commit .committed_datetime == datetime (2009 , 10 , 8 , 18 , 22 , 51 , tzinfo = utc ), commit .committed_datetime
390+ self .assertEqual (commit .authored_date , 1255018625 )
391+ self .assertEqual (commit .committed_date , 1255026171 )
392+ self .assertEqual (commit .authored_datetime ,
393+ datetime (2009 , 10 , 8 , 18 , 17 , 5 , tzinfo = tzoffset (- 7200 )), commit .authored_datetime ) # noqa
394+ self .assertEqual (commit .authored_datetime ,
395+ datetime (2009 , 10 , 8 , 16 , 17 , 5 , tzinfo = utc ), commit .authored_datetime )
396+ self .assertEqual (commit .committed_datetime ,
397+ datetime (2009 , 10 , 8 , 20 , 22 , 51 , tzinfo = tzoffset (- 7200 )))
398+ self .assertEqual (commit .committed_datetime ,
399+ datetime (2009 , 10 , 8 , 18 , 22 , 51 , tzinfo = utc ), commit .committed_datetime )
0 commit comments