1515
1616class  TestRefs (TestBase ):
1717
18- 	def  _test_from_path (self ):
18+ 	def  test_from_path (self ):
1919		# should be able to create any reference directly 
2020		for  ref_type  in  ( Reference , Head , TagReference , RemoteReference  ):
2121			for  name  in  ('rela_name' , 'path/rela_name' ):
@@ -25,7 +25,7 @@ def _test_from_path(self):
2525			# END for each name  
2626		# END for each type 
2727
28- 	def  _test_tag_base (self ):
28+ 	def  test_tag_base (self ):
2929		tag_object_refs  =  list ()
3030		for  tag  in  self .rorepo .tags :
3131			assert  "refs/tags"  in  tag .path 
@@ -50,7 +50,7 @@ def _test_tag_base(self):
5050		assert  tag_object_refs 
5151		assert  isinstance (self .rorepo .tags ['0.1.5' ], TagReference )
5252
53- 	def  _test_tags (self ):
53+ 	def  test_tags (self ):
5454		# tag refs can point to tag objects or to commits 
5555		s  =  set ()
5656		ref_count  =  0 
@@ -67,7 +67,7 @@ def _test_tags(self):
6767		assert  len (s | s ) ==  ref_count 
6868
6969	@with_rw_repo ('HEAD' , bare = False ) 
70- 	def  _test_heads (self , rwrepo ):
70+ 	def  test_heads (self , rwrepo ):
7171		for  head  in  rwrepo .heads :
7272			assert  head .name 
7373			assert  head .path 
@@ -129,7 +129,7 @@ def _test_heads(self, rwrepo):
129129		# TODO: Need changing a ref changes HEAD reflog as well if it pointed to it 
130130
131131
132- 	def  _test_refs (self ):
132+ 	def  test_refs (self ):
133133		types_found  =  set ()
134134		for  ref  in  self .rorepo .refs :
135135			types_found .add (type (ref ))
@@ -142,7 +142,7 @@ def test_is_valid(self):
142142		assert  SymbolicReference (self .rorepo , 'hellothere' ).is_valid () ==  False 
143143
144144	@with_rw_repo ('0.1.6' ) 
145- 	def  _test_head_reset (self , rw_repo ):
145+ 	def  test_head_reset (self , rw_repo ):
146146		cur_head  =  rw_repo .head 
147147		old_head_commit  =  cur_head .commit 
148148		new_head_commit  =  cur_head .ref .commit .parents [0 ]
@@ -292,7 +292,11 @@ def _test_head_reset(self, rw_repo):
292292		head_tree  =  head .commit .tree 
293293		self .failUnlessRaises (ValueError , setattr , head , 'commit' , head_tree )
294294		assert  head .commit  ==  old_commit 		# and the ref did not change 
295- 		self .failUnlessRaises (GitCommandError , setattr , head , 'object' , head_tree )
295+ 		# we allow heds to point to any object 
296+ 		head .object  =  head_tree 
297+ 		assert  head .object  ==  head_tree 
298+ 		# cannot query tree as commit 
299+ 		self .failUnlessRaises (TypeError , getattr , head , 'commit' ) 
296300
297301		# set the commit directly using the head. This would never detach the head 
298302		assert  not  cur_head .is_detached 
@@ -488,20 +492,20 @@ def _test_head_reset(self, rw_repo):
488492
489493			Reference .delete (ref .repo , ref .path )
490494			assert  not  ref .is_valid ()
491- 			self .failUnlessRaises (GitCommandError , setattr , ref , 'object' , "nonsense" )
495+ 			self .failUnlessRaises (ValueError , setattr , ref , 'object' , "nonsense" )
492496			assert  not  ref .is_valid ()
493497
494498		# END for each path 
495499
496- 	def  _test_dereference_recursive (self ):
500+ 	def  test_dereference_recursive (self ):
497501		# for now, just test the HEAD 
498502		assert  SymbolicReference .dereference_recursive (self .rorepo , 'HEAD' )
499503
500- 	def  _test_reflog (self ):
504+ 	def  test_reflog (self ):
501505		assert  isinstance (self .rorepo .heads .master .log (), RefLog )
502506
503507
504- 	def  _test_todo (self ):
508+ 	def  test_todo (self ):
505509		# delete deletes the reflog 
506510		# create creates a new entry 
507511		# set_reference and set_commit and set_object use the reflog if message is given 
0 commit comments