Some small comments:
* diff_bytes needs to be documented in the difflib docs and in Doc/whatsnew/3.5.rst.
* diff_bytes needs to be added to difflib.__all__
* This looks like a new feature to me, so it would be better to just commit it to the default branch.
+ except AttributeError:
+ raise TypeError('all arguments must be bytes, not %r' % s)
This could be changed to raise TypeError(...) from None
+ self.assertTrue(
+ isinstance(line, bytes),
assertIsInstance
+ try:
+ list(difflib.unified_diff(a, b, fna, fnb))
+ self.fail('expected TypeError')
+ except TypeError:
+ pass
with self.assertRaises(TypeError):
list(difflib.unified_diff(a, b, fna, fnb))
looks more readable to me. |