@@ -112,6 +112,33 @@ def test_diff_with_rename(self):
112112 self .assertEqual (diff .score , 100 )
113113 self .assertEqual (len (list (diffs .iter_change_type ('R' ))), 1 )
114114
115+ def test_diff_with_change_in_type (self ):
116+ output = StringProcessAdapter (fixture ('diff_change_in_type' ))
117+ diffs = Diff ._index_from_patch_format (self .rorepo , output )
118+ self ._assert_diff_format (diffs )
119+ assert_equal (2 , len (diffs ))
120+
121+ diff = diffs [0 ]
122+ self .assertIsNotNone (diff .deleted_file )
123+ assert_equal (diff .a_path , 'this' )
124+ assert_equal (diff .b_path , 'this' )
125+ assert isinstance (str (diff ), str )
126+
127+ diff = diffs [1 ]
128+ assert_equal (diff .a_path , None )
129+ assert_equal (diff .b_path , 'this' )
130+ self .assertIsNotNone (diff .new_file )
131+ assert isinstance (str (diff ), str )
132+
133+ output = StringProcessAdapter (fixture ('diff_change_in_type_raw' ))
134+ diffs = Diff ._index_from_raw_format (self .rorepo , output )
135+ self .assertEqual (len (diffs ), 1 )
136+ diff = diffs [0 ]
137+ self .assertEqual (diff .rename_from , None )
138+ self .assertEqual (diff .rename_to , None )
139+ self .assertEqual (diff .change_type , 'T' )
140+ self .assertEqual (len (list (diffs .iter_change_type ('T' ))), 1 )
141+
115142 def test_diff_of_modified_files_not_added_to_the_index (self ):
116143 output = StringProcessAdapter (fixture ('diff_abbrev-40_full-index_M_raw_no-color' ))
117144 diffs = Diff ._index_from_raw_format (self .rorepo , output )
0 commit comments