|
24 | 24 | DiffIndex, |
25 | 25 | NULL_TREE, |
26 | 26 | ) |
| 27 | +import ddt |
27 | 28 |
|
28 | 29 |
|
| 30 | +@ddt.ddt |
29 | 31 | class TestDiff(TestBase): |
30 | 32 |
|
31 | 33 | def tearDown(self): |
@@ -118,18 +120,20 @@ def test_diff_of_modified_files_not_added_to_the_index(self): |
118 | 120 | self.assertEqual(diffs[0].change_type, 'M') |
119 | 121 | self.assertIsNone(diffs[0].b_blob,) |
120 | 122 |
|
121 | | - def test_binary_diff(self): |
122 | | - for method, file_name in ((Diff._index_from_patch_format, 'diff_patch_binary'), |
123 | | - (Diff._index_from_raw_format, 'diff_raw_binary')): |
124 | | - res = method(None, StringProcessAdapter(fixture(file_name)).stdout) |
125 | | - self.assertEqual(len(res), 1) |
126 | | - self.assertEqual(len(list(res.iter_change_type('M'))), 1) |
127 | | - if res[0].diff: |
128 | | - self.assertEqual(res[0].diff, |
129 | | - b"Binary files a/rps and b/rps differ\n", |
130 | | - "in patch mode, we get a diff text") |
131 | | - self.assertIsNotNone(str(res[0]), "This call should just work") |
132 | | - # end for each method to test |
| 123 | + @ddt.data( |
| 124 | + (Diff._index_from_patch_format, 'diff_patch_binary'), |
| 125 | + (Diff._index_from_raw_format, 'diff_raw_binary') |
| 126 | + ) |
| 127 | + def test_binary_diff(self, case): |
| 128 | + method, file_name = case |
| 129 | + res = method(None, StringProcessAdapter(fixture(file_name)).stdout) |
| 130 | + self.assertEqual(len(res), 1) |
| 131 | + self.assertEqual(len(list(res.iter_change_type('M'))), 1) |
| 132 | + if res[0].diff: |
| 133 | + self.assertEqual(res[0].diff, |
| 134 | + b"Binary files a/rps and b/rps differ\n", |
| 135 | + "in patch mode, we get a diff text") |
| 136 | + self.assertIsNotNone(str(res[0]), "This call should just work") |
133 | 137 |
|
134 | 138 | def test_diff_index(self): |
135 | 139 | output = StringProcessAdapter(fixture('diff_index_patch')) |
|
0 commit comments