Py3: Use BytesIO instead of StringIO

This commit is contained in:
Shadab Zafar 2016-06-07 12:08:20 +05:30
parent 4f97216501
commit 0280af9522
1 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
from six.moves import cStringIO as StringIO
from six import BytesIO
import netlib
from netlib import tcp
@ -25,7 +25,7 @@ def default_settings():
def test_make_error_response():
d = StringIO()
d = BytesIO()
s = http2.make_error_response("foo", "bar")
language.serve(s, d, default_settings())
@ -84,7 +84,7 @@ class TestRequest:
assert r[1].method.string() == "GET"
def test_render_simple(self):
s = StringIO()
s = BytesIO()
r = parse_request("GET:'/foo'")
assert language.serve(
r,
@ -126,7 +126,7 @@ class TestRequest:
assert r.headers[0].values(default_settings()) == ("user-agent", user_agents.get_by_shortcut('a')[2])
def test_render_with_headers(self):
s = StringIO()
s = BytesIO()
r = parse_request('GET:/foo:h"foo"="bar"')
assert language.serve(
r,
@ -142,7 +142,7 @@ class TestRequest:
assert r.values(default_settings())
def test_render_with_body(self):
s = StringIO()
s = BytesIO()
r = parse_request("GET:'/foo':bfoobar")
assert language.serve(
r,
@ -199,7 +199,7 @@ class TestResponse:
assert r.body.string() == "foobar"
def test_render_simple(self):
s = StringIO()
s = BytesIO()
r = parse_response('200')
assert language.serve(
r,
@ -208,7 +208,7 @@ class TestResponse:
)
def test_render_with_headers(self):
s = StringIO()
s = BytesIO()
r = parse_response('200:h"foo"="bar"')
assert language.serve(
r,
@ -217,7 +217,7 @@ class TestResponse:
)
def test_render_with_body(self):
s = StringIO()
s = BytesIO()
r = parse_response('200:bfoobar')
assert language.serve(
r,