← Back to team overview

testtools-dev team mailing list archive

[Merge] lp:~lifeless/testtools/3.2 into lp:testtools

 

Robert Collins has proposed merging lp:~lifeless/testtools/3.2 into lp:testtools.

Requested reviews:
  testtools committers (testtools-committers)

For more details, see:
https://code.launchpad.net/~lifeless/testtools/3.2/+merge/140092

Bitrot must die.
-- 
https://code.launchpad.net/~lifeless/testtools/3.2/+merge/140092
Your team testtools developers is subscribed to branch lp:testtools.
=== modified file 'testtools/tests/test_content.py'
--- testtools/tests/test_content.py	2012-12-10 22:57:03 +0000
+++ testtools/tests/test_content.py	2012-12-16 12:34:22 +0000
@@ -9,6 +9,7 @@
 from testtools.compat import (
     _b,
     _u,
+    BytesIO,
     StringIO,
     )
 from testtools.content import (
@@ -127,24 +128,23 @@
 
     def test_from_file_with_simple_seek(self):
         f = tempfile.NamedTemporaryFile()
-        f.write('some data')
+        f.write(_b('some data'))
         f.flush()
         self.addCleanup(f.close)
         content = content_from_file(
             f.name, UTF8_TEXT, chunk_size=50, seek_offset=5)
         self.assertThat(
-            list(content.iter_bytes()), Equals(['data']))
+            list(content.iter_bytes()), Equals([_b('data')]))
 
     def test_from_file_with_whence_seek(self):
         f = tempfile.NamedTemporaryFile()
-        f.write('some data')
+        f.write(_b('some data'))
         f.flush()
         self.addCleanup(f.close)
         content = content_from_file(
             f.name, UTF8_TEXT, chunk_size=50, seek_offset=-4, seek_whence=2)
         self.assertThat(
-            list(content.iter_bytes()), Equals(['data']))
-
+            list(content.iter_bytes()), Equals([_b('data')]))
 
     def test_from_stream(self):
         data = StringIO('some data')
@@ -170,18 +170,18 @@
             ''.join(content.iter_text()), Equals('some data'))
 
     def test_from_stream_with_simple_seek(self):
-        data = StringIO('some data')
+        data = BytesIO(_b('some data'))
         content = content_from_stream(
             data, UTF8_TEXT, chunk_size=50, seek_offset=5)
         self.assertThat(
-            list(content.iter_bytes()), Equals(['data']))
+            list(content.iter_bytes()), Equals([_b('data')]))
 
     def test_from_stream_with_whence_seek(self):
-        data = StringIO('some data')
+        data = BytesIO(_b('some data'))
         content = content_from_stream(
             data, UTF8_TEXT, chunk_size=50, seek_offset=-4, seek_whence=2)
         self.assertThat(
-            list(content.iter_bytes()), Equals(['data']))
+            list(content.iter_bytes()), Equals([_b('data')]))
 
     def test_from_text(self):
         data = _u("some data")


Follow ups