summaryrefslogtreecommitdiffstats
path: root/scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/tests/test_pair.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-03-20 11:49:17 +0200
committerimarom <imarom@cisco.com>2016-03-20 11:50:17 +0200
commit94ec2f0c0a6fc30fb3a9a11243146e0d878c4c5b (patch)
treea63d4b1e4b22938a3506a55030a3866e0d5211ca /scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/tests/test_pair.py
parent33c80d0f2c3af8b302e50ce3925869dfd37267ed (diff)
ZMQ CEL5.9 / 32 bit / 64 bit with python 2 / python 3
Diffstat (limited to 'scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/tests/test_pair.py')
-rw-r--r--scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/tests/test_pair.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/tests/test_pair.py b/scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/tests/test_pair.py
new file mode 100644
index 00000000..e88c1e8b
--- /dev/null
+++ b/scripts/external_libs/pyzmq-14.5.0/cel59/python2/32bit/zmq/tests/test_pair.py
@@ -0,0 +1,53 @@
+# Copyright (C) PyZMQ Developers
+# Distributed under the terms of the Modified BSD License.
+
+
+import zmq
+
+
+from zmq.tests import BaseZMQTestCase, have_gevent, GreenTest
+
+
+x = b' '
+class TestPair(BaseZMQTestCase):
+
+ def test_basic(self):
+ s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR)
+
+ msg1 = b'message1'
+ msg2 = self.ping_pong(s1, s2, msg1)
+ self.assertEqual(msg1, msg2)
+
+ def test_multiple(self):
+ s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR)
+
+ for i in range(10):
+ msg = i*x
+ s1.send(msg)
+
+ for i in range(10):
+ msg = i*x
+ s2.send(msg)
+
+ for i in range(10):
+ msg = s1.recv()
+ self.assertEqual(msg, i*x)
+
+ for i in range(10):
+ msg = s2.recv()
+ self.assertEqual(msg, i*x)
+
+ def test_json(self):
+ s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR)
+ o = dict(a=10,b=list(range(10)))
+ o2 = self.ping_pong_json(s1, s2, o)
+
+ def test_pyobj(self):
+ s1, s2 = self.create_bound_pair(zmq.PAIR, zmq.PAIR)
+ o = dict(a=10,b=range(10))
+ o2 = self.ping_pong_pyobj(s1, s2, o)
+
+if have_gevent:
+ class TestReqRepGreen(GreenTest, TestPair):
+ pass
+