/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 bzrlib/tests/test_transport_implementations.py

  • Committer: Vincent Ladeuil
  • Date: 2007-12-10 10:41:24 UTC
  • mto: (3097.2.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 3099.
  • Revision ID: v.ladeuil+lp@free.fr-20071210104124-0brt3h7ed1kiug0v
Take spiv review comments into account.

* bzrlib/transport/http/response.py:
(RangeFile._seek_to_next_range): Factored out since this is now
used by both seek and read.
(RangeFile.read): Trigger next range recognition when needed.
(RangeFile.seek): Don't seek over the range boundary if not
required to.

* bzrlib/transport/http/__init__.py:
(HttpTransportBase._coalesce_readv.get_and_yield): Add a
prophylactic assertionError.

* bzrlib/tests/test_transport_implementations.py:
Fix typos.

* bzrlib/tests/test_http_response.py:
(TestRangeFileMixin.test_read_zero,
TestRangeFileMixin.test_seek_at_range_end,
TestRangeFileMixin.test_read_at_range_end,
TestRangeFileSizeUnknown.test_read_at_range_end,
TestRangeFilMultipleRanges.test_seek_at_range_end,
TestRangeFilMultipleRanges.test_read_at_range_end): More tests
covering read(0).

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
        self.build_tree(files, transport=t, line_endings='binary')
188
188
        self.check_transport_contents('contents of a\n', t, 'a')
189
189
        content_f = t.get_multi(files)
190
 
        # Use itertools.imap() instead of use zip() or map(), since they fully
 
190
        # Use itertools.izip() instead of use zip() or map(), since they fully
191
191
        # evaluate their inputs, the transport requests should be issued and
192
192
        # handled sequentially (we don't want to force transport to buffer).
193
193
        for content, f in itertools.izip(contents, content_f):
194
194
            self.assertEqual(content, f.read())
195
195
 
196
196
        content_f = t.get_multi(iter(files))
197
 
        # Use itertools.imap() for the same reason
 
197
        # Use itertools.izip() for the same reason
198
198
        for content, f in itertools.izip(contents, content_f):
199
199
            self.assertEqual(content, f.read())
200
200
 
983
983
        self.check_transport_contents('c this file\n', t, 'b')
984
984
 
985
985
        # TODO: Try to write a test for atomicity
986
 
        # TODO: Test moving into a non-existant subdirectory
 
986
        # TODO: Test moving into a non-existent subdirectory
987
987
        # TODO: Test Transport.move_multi
988
988
 
989
989
    def test_copy(self):
1286
1286
        self.assertEqual('', t.relpath(t.base))
1287
1287
        # base ends with /
1288
1288
        self.assertEqual('', t.relpath(t.base[:-1]))
1289
 
        # subdirs which dont exist should still give relpaths.
 
1289
        # subdirs which don't exist should still give relpaths.
1290
1290
        self.assertEqual('foo', t.relpath(t.base + 'foo'))
1291
1291
        # trailing slash should be the same.
1292
1292
        self.assertEqual('foo', t.relpath(t.base + 'foo/'))
1574
1574
                adjust_for_latency=True, upper_limit=content_size))
1575
1575
            self.assertEqual(1, len(result))
1576
1576
            data_len = len(result[0][1])
1577
 
            # minimmum length is from 400 to 1034 - 634
 
1577
            # minimum length is from 400 to 1034 - 634
1578
1578
            self.assertTrue(data_len >= 634)
1579
1579
            # must contain the region 400 to 1034
1580
1580
            self.assertTrue(result[0][0] <= 400)