76
76
udiff_lines([1023 * 'a' + '\x00'], [], allow_binary=True)
77
77
udiff_lines([], [1023 * 'a' + '\x00'], allow_binary=True)
79
def test_internal_diff_default(self):
80
# Default internal diff encoding is utf8
82
internal_diff(u'old_\xb5', ['old_text\n'],
83
u'new_\xe5', ['new_text\n'], output)
84
lines = output.getvalue().splitlines(True)
85
self.check_patch(lines)
86
self.assertEquals(['--- old_\xc2\xb5\t\n',
87
'+++ new_\xc3\xa5\t\n',
95
def test_internal_diff_utf8(self):
97
internal_diff(u'old_\xb5', ['old_text\n'],
98
u'new_\xe5', ['new_text\n'], output,
100
lines = output.getvalue().splitlines(True)
101
self.check_patch(lines)
102
self.assertEquals(['--- old_\xc2\xb5\t\n',
103
'+++ new_\xc3\xa5\t\n',
111
def test_internal_diff_iso_8859_1(self):
113
internal_diff(u'old_\xb5', ['old_text\n'],
114
u'new_\xe5', ['new_text\n'], output,
115
path_encoding='iso-8859-1')
116
lines = output.getvalue().splitlines(True)
117
self.check_patch(lines)
118
self.assertEquals(['--- old_\xb5\t\n',
127
def test_internal_diff_returns_bytes(self):
129
output = StringIO.StringIO()
130
internal_diff(u'old_\xb5', ['old_text\n'],
131
u'new_\xe5', ['new_text\n'], output)
132
self.failUnless(isinstance(output.getvalue(), str),
133
'internal_diff should return bytestrings')
80
136
class TestPatienceDiffLib(TestCase):