aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_rparse.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/test_rparse.py b/test/test_rparse.py
index cb1076c2..f4b408b2 100644
--- a/test/test_rparse.py
+++ b/test/test_rparse.py
@@ -250,6 +250,18 @@ class TestParseResponse:
class TestWriteValues:
+ def test_send_chunk(self):
+ v = "foobarfoobar"
+ for bs in range(1, len(v)+2):
+ s = cStringIO.StringIO()
+ rparse.send_chunk(s, v, bs, 0, len(v))
+ assert s.getvalue() == v
+ for start in range(len(v)):
+ for end in range(len(v)):
+ s = cStringIO.StringIO()
+ rparse.send_chunk(s, v, bs, start, end)
+ assert s.getvalue() == v[start:end]
+
def test_write_values_disconnects(self):
s = cStringIO.StringIO()
tst = "foo"*100
@@ -257,11 +269,17 @@ class TestWriteValues:
assert not s.getvalue()
def test_write_values(self):
- tst = "foo"*1025
+ tst = "foobarvoing"
s = cStringIO.StringIO()
rparse.write_values(s, [tst], [])
assert s.getvalue() == tst
+ for bs in range(1, len(tst) + 2):
+ for off in range(len(tst)):
+ s = cStringIO.StringIO()
+ rparse.write_values(s, [tst], [(off, "disconnect")], blocksize=bs)
+ assert s.getvalue() == tst[:off]
+
def test_write_values_pauses(self):
tst = "".join(str(i) for i in range(10))
for i in range(2, 10):