1
from StringIO import StringIO
3
from bzrlib.errors import BinaryFile
4
from bzrlib.tests import TestCase
5
from bzrlib.textfile import text_file
8
class TextFile(TestCase):
9
def test_text_file(self):
10
s = StringIO('ab' * 2048)
12
self.assertEqual(text_file(s).read(), s.getvalue())
13
s = StringIO('a' * 1023 + '\x00')
14
self.assertRaises(BinaryFile, text_file, s)
15
s = StringIO('a' * 1024 + '\x00')
16
self.assertEqual(text_file(s).read(), s.getvalue())