/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_textfile.py

  • Committer: Jelmer Vernooij
  • Date: 2018-02-18 21:42:57 UTC
  • mto: This revision was merged to the branch mainline in revision 6859.
  • Revision ID: jelmer@jelmer.uk-20180218214257-jpevutp1wa30tz3v
Update TODO to reference Breezy, not Bazaar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from io import BytesIO
18
17
 
19
18
from ..errors import BinaryFile
 
19
from ..sixish import (
 
20
    BytesIO,
 
21
    )
20
22
from . import TestCase, TestCaseInTempDir
21
23
from ..textfile import text_file, check_text_lines, check_text_path
22
24
 
32
34
        self.assertEqual(text_file(s).read(), s.getvalue())
33
35
 
34
36
    def test_check_text_lines(self):
35
 
        lines = [b'ab' * 2048]
 
37
        lines = ['ab' * 2048]
36
38
        check_text_lines(lines)
37
 
        lines = [b'a' * 1023 + b'\x00']
 
39
        lines = ['a' * 1023 + '\x00']
38
40
        self.assertRaises(BinaryFile, check_text_lines, lines)
39
41
 
40
42
 
41
43
class TextPath(TestCaseInTempDir):
42
44
 
43
45
    def test_text_file(self):
44
 
        with open('boo', 'wb') as f:
45
 
            f.write(b'ab' * 2048)
 
46
        with file('boo', 'wb') as f: f.write('ab' * 2048)
46
47
        check_text_path('boo')
47
 
        with open('boo', 'wb') as f:
48
 
            f.write(b'a' * 1023 + b'\x00')
 
48
        with file('boo', 'wb') as f: f.write('a' * 1023 + '\x00')
49
49
        self.assertRaises(BinaryFile, check_text_path, 'boo')