~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-12-11 20:23:00 UTC
  • mfrom: (3890.2.18 get_record_stream_chunked)
  • Revision ID: pqm@pqm.ubuntu.com-20081211202300-6dz1vo3phfsc23pj
(jam) Add ContentFactory.get_bytes_as('chunked') and
        osutils.chunks_to_lines()

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
756
756
        self.assertEndsWith(osutils._mac_getcwd(), u'B\xe5gfors')
757
757
 
758
758
 
 
759
class TestChunksToLines(TestCase):
 
760
 
 
761
    def test_smoketest(self):
 
762
        self.assertEqual(['foo\n', 'bar\n', 'baz\n'],
 
763
                         osutils.chunks_to_lines(['foo\nbar', '\nbaz\n']))
 
764
        self.assertEqual(['foo\n', 'bar\n', 'baz\n'],
 
765
                         osutils.chunks_to_lines(['foo\n', 'bar\n', 'baz\n']))
 
766
 
 
767
    def test_is_compiled(self):
 
768
        from bzrlib.tests.test__chunks_to_lines import CompiledChunksToLinesFeature
 
769
        if CompiledChunksToLinesFeature:
 
770
            from bzrlib._chunks_to_lines_pyx import chunks_to_lines
 
771
        else:
 
772
            from bzrlib._chunks_to_lines_py import chunks_to_lines
 
773
        self.assertIs(chunks_to_lines, osutils.chunks_to_lines)
 
774
 
 
775
 
759
776
class TestSplitLines(TestCase):
760
777
 
761
778
    def test_split_unicode(self):