--- a/tests/test-wireproto-serverreactor.py Mon Apr 02 17:06:42 2018 +0530
+++ b/tests/test-wireproto-serverreactor.py Fri Mar 30 14:52:32 2018 -0700
@@ -136,22 +136,6 @@
ffs(b'1 1 0 command-data eos %s' % data.getvalue()),
])
- def testtextoutputexcessiveargs(self):
- """At most 255 formatting arguments are allowed."""
- with self.assertRaisesRegexp(ValueError,
- 'cannot use more than 255 formatting'):
- args = [b'x' for i in range(256)]
- list(framing.createtextoutputframe(None, 1,
- [(b'bleh', args, [])]))
-
- def testtextoutputexcessivelabels(self):
- """At most 255 labels are allowed."""
- with self.assertRaisesRegexp(ValueError,
- 'cannot use more than 255 labels'):
- labels = [b'l' for i in range(256)]
- list(framing.createtextoutputframe(None, 1,
- [(b'bleh', [], labels)]))
-
def testtextoutputformattingstringtype(self):
"""Formatting string must be bytes."""
with self.assertRaisesRegexp(ValueError, 'must use bytes formatting '):
@@ -168,31 +152,14 @@
list(framing.createtextoutputframe(None, 1, [
(b'foo', [], [b'foo'.decode('ascii')])]))
- def testtextoutputtoolongformatstring(self):
- with self.assertRaisesRegexp(ValueError,
- 'formatting string cannot be longer than'):
- list(framing.createtextoutputframe(None, 1, [
- (b'x' * 65536, [], [])]))
-
- def testtextoutputtoolongargumentstring(self):
- with self.assertRaisesRegexp(ValueError,
- 'argument string cannot be longer than'):
- list(framing.createtextoutputframe(None, 1, [
- (b'bleh', [b'x' * 65536], [])]))
-
- def testtextoutputtoolonglabelstring(self):
- with self.assertRaisesRegexp(ValueError,
- 'label string cannot be longer than'):
- list(framing.createtextoutputframe(None, 1, [
- (b'bleh', [], [b'x' * 65536])]))
-
def testtextoutput1simpleatom(self):
stream = framing.stream(1)
val = list(framing.createtextoutputframe(stream, 1, [
(b'foo', [], [])]))
self.assertEqual(val, [
- ffs(br'1 1 stream-begin text-output 0 \x03\x00\x00\x00foo'),
+ ffs(b'1 1 stream-begin text-output 0 '
+ b"cbor:[{b'msg': b'foo'}]"),
])
def testtextoutput2simpleatoms(self):
@@ -203,8 +170,8 @@
]))
self.assertEqual(val, [
- ffs(br'1 1 stream-begin text-output 0 '
- br'\x03\x00\x00\x00foo\x03\x00\x00\x00bar'),
+ ffs(b'1 1 stream-begin text-output 0 '
+ b"cbor:[{b'msg': b'foo'}, {b'msg': b'bar'}]")
])
def testtextoutput1arg(self):
@@ -214,8 +181,8 @@
]))
self.assertEqual(val, [
- ffs(br'1 1 stream-begin text-output 0 '
- br'\x06\x00\x00\x01\x04\x00foo %sval1'),
+ ffs(b'1 1 stream-begin text-output 0 '
+ b"cbor:[{b'msg': b'foo %s', b'args': [b'val1']}]")
])
def testtextoutput2arg(self):
@@ -225,8 +192,8 @@
]))
self.assertEqual(val, [
- ffs(br'1 1 stream-begin text-output 0 '
- br'\x09\x00\x00\x02\x03\x00\x05\x00foo %s %svalvalue'),
+ ffs(b'1 1 stream-begin text-output 0 '
+ b"cbor:[{b'msg': b'foo %s %s', b'args': [b'val', b'value']}]")
])
def testtextoutput1label(self):
@@ -236,8 +203,8 @@
]))
self.assertEqual(val, [
- ffs(br'1 1 stream-begin text-output 0 '
- br'\x03\x00\x01\x00\x05foolabel'),
+ ffs(b'1 1 stream-begin text-output 0 '
+ b"cbor:[{b'msg': b'foo', b'labels': [b'label']}]")
])
def testargandlabel(self):
@@ -247,8 +214,9 @@
]))
self.assertEqual(val, [
- ffs(br'1 1 stream-begin text-output 0 '
- br'\x06\x00\x01\x01\x05\x03\x00foo %slabelarg'),
+ ffs(b'1 1 stream-begin text-output 0 '
+ b"cbor:[{b'msg': b'foo %s', b'args': [b'arg'], "
+ b"b'labels': [b'label']}]")
])
class ServerReactorTests(unittest.TestCase):