Rev 6577: TDD backwards, works here ; ) in file:///home/vila/src/bzr/bugs/1184021/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri May 24 23:45:56 UTC 2013


At file:///home/vila/src/bzr/bugs/1184021/

------------------------------------------------------------
revno: 6577
revision-id: v.ladeuil+lp at free.fr-20130524234555-3z0fvi457ndite4j
parent: jelmer at gwenhwyvar.vernstok.nl-20130524222626-00igsjy6ubwjupzq
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 1184021
timestamp: Sat 2013-05-25 01:45:55 +0200
message:
  TDD backwards, works here ;)
-------------- next part --------------
=== modified file 'bzrlib/tests/test_http_response.py'
--- a/bzrlib/tests/test_http_response.py	2012-08-04 11:16:14 +0000
+++ b/bzrlib/tests/test_http_response.py	2013-05-24 23:45:55 +0000
@@ -75,6 +75,18 @@
         pass
 
 
+class TestResponseFileIter(tests.TestCase):
+
+    def test_iter_empty(self):
+        self._file = response.ResponseFile('empty', StringIO())
+        self.assertEqual([], list(self._file))
+
+    def test_iter_many(self):
+        self._file = response.ResponseFile(
+            'many', StringIO('0\n1\nboo!\n'))
+        self.assertEqual(['0\n', '1\n', 'boo!\n'], list(self._file))
+
+
 class TestHTTPConnection(tests.TestCase):
 
     def test_cleanup_pipe(self):
@@ -137,7 +149,6 @@
 
     def test_read_zero(self):
         f = self._file
-        start = self.first_range_start
         self.assertEquals('', f.read(0))
         f.seek(10, 1)
         self.assertEquals('', f.read(0))
@@ -371,13 +382,11 @@
 
     def test_seek_across_ranges(self):
         f = self._file
-        start = self.first_range_start
         f.seek(126) # skip the two first ranges
         self.assertEquals('AB', f.read(2))
 
     def test_checked_read_dont_overflow_buffers(self):
         f = self._file
-        start = self.first_range_start
         # We force a very low value to exercise all code paths in _checked_read
         f._discarded_buf_size = 8
         f.seek(126) # skip the two first ranges

=== modified file 'bzrlib/transport/http/response.py'
--- a/bzrlib/transport/http/response.py	2013-05-24 22:26:26 +0000
+++ b/bzrlib/transport/http/response.py	2013-05-24 23:45:55 +0000
@@ -38,6 +38,7 @@
     """A wrapper around the http socket containing the result of a GET request.
 
     Only read() and seek() (forward) are supported.
+
     """
     def __init__(self, path, infile):
         """Constructor.



More information about the bazaar-commits mailing list