211
211
self.assertIsInstance(output.getvalue(), str,
212
212
'internal_diff should return bytestrings')
214
def test_internal_diff_default_context(self):
216
diff.internal_diff('old', ['same_text\n','same_text\n','same_text\n',
217
'same_text\n','same_text\n','old_text\n'],
218
'new', ['same_text\n','same_text\n','same_text\n',
219
'same_text\n','same_text\n','new_text\n'], output)
220
lines = output.getvalue().splitlines(True)
221
self.check_patch(lines)
222
self.assertEquals(['--- old\n',
234
def test_internal_diff_no_context(self):
236
diff.internal_diff('old', ['same_text\n','same_text\n','same_text\n',
237
'same_text\n','same_text\n','old_text\n'],
238
'new', ['same_text\n','same_text\n','same_text\n',
239
'same_text\n','same_text\n','new_text\n'], output,
241
lines = output.getvalue().splitlines(True)
242
self.check_patch(lines)
243
self.assertEquals(['--- old\n',
252
def test_internal_diff_more_context(self):
254
diff.internal_diff('old', ['same_text\n','same_text\n','same_text\n',
255
'same_text\n','same_text\n','old_text\n'],
256
'new', ['same_text\n','same_text\n','same_text\n',
257
'same_text\n','same_text\n','new_text\n'], output,
259
lines = output.getvalue().splitlines(True)
260
self.check_patch(lines)
261
self.assertEquals(['--- old\n',
215
278
class TestDiffFiles(tests.TestCaseInTempDir):