diff options
author | JJ Graham <thetwoj@gmail.com> | 2019-10-17 22:15:45 -0500 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2019-10-19 13:17:16 +0200 |
commit | 59ad90694b5393ce7f6790ade9cb58c24b8028e5 (patch) | |
tree | db71095dec73f773c59b1066954bba94b44cd4c5 /git/test/test_diff.py | |
parent | 43564d2e8f3b95f33e10a5c8cc2d75c0252d659a (diff) | |
download | gitpython-59ad90694b5393ce7f6790ade9cb58c24b8028e5.tar.gz |
Adding diff support for copied files, still working on test
Diffstat (limited to 'git/test/test_diff.py')
-rw-r--r-- | git/test/test_diff.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/git/test/test_diff.py b/git/test/test_diff.py index e47b9331..079f8bea 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -112,6 +112,27 @@ class TestDiff(TestBase): self.assertEqual(diff.score, 100) self.assertEqual(len(list(diffs.iter_change_type('R'))), 1) + def test_diff_with_copied_file(self): + output = StringProcessAdapter(fixture('diff_copied_mode')) + diffs = Diff._index_from_patch_format(self.rorepo, output) + self._assert_diff_format(diffs) + + assert_equal(1, len(diffs)) + + diff = diffs[0] + print(diff) + assert_true(diff.copied_file) + assert isinstance(str(diff), str) + + output = StringProcessAdapter(fixture('diff_copied_mode_raw')) + diffs = Diff._index_from_raw_format(self.rorepo, output) + self.assertEqual(len(diffs), 1) + diff = diffs[0] + self.assertEqual(diff.change_type, 'C') + self.assertEqual(diff.score, 100) + self.assertEqual(len(list(diffs.iter_change_type('C'))), 1) + + def test_diff_with_change_in_type(self): output = StringProcessAdapter(fixture('diff_change_in_type')) diffs = Diff._index_from_patch_format(self.rorepo, output) |