~ubuntu-branches/ubuntu/precise/pyzmq/precise

« back to all changes in this revision

Viewing changes to zmq/tests/test_reqrep.py

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Ożarowski
  • Date: 2011-02-15 09:08:36 UTC
  • mfrom: (2.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110215090836-phh4slym1g6muucn
Tags: 2.0.10.1-2
* Team upload.
* Upload to unstable
* Add Breaks: ${python:Breaks}

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    def test_basic(self):
36
36
        s1, s2 = self.create_bound_pair(zmq.REQ, zmq.REP)
37
37
 
38
 
        msg1 = 'message 1'
 
38
        msg1 = 'message 1'.encode()
39
39
        msg2 = self.ping_pong(s1, s2, msg1)
40
40
        self.assertEquals(msg1, msg2)
41
41
 
43
43
        s1, s2 = self.create_bound_pair(zmq.REQ, zmq.REP)
44
44
 
45
45
        for i in range(10):
46
 
            msg1 = i*' '
 
46
            msg1 = i*' '.encode()
47
47
            msg2 = self.ping_pong(s1, s2, msg1)
48
48
            self.assertEquals(msg1, msg2)
49
49
 
50
50
    def test_bad_send_recv(self):
51
51
        s1, s2 = self.create_bound_pair(zmq.REQ, zmq.REP)
52
 
        self.assertRaisesErrno(zmq.EFSM, s1.recv)
53
 
        self.assertRaisesErrno(zmq.EFSM, s2.send, 'asdf')
 
52
        for copy in (True,False):
 
53
            self.assertRaisesErrno(zmq.EFSM, s1.recv, copy=copy)
 
54
            self.assertRaisesErrno(zmq.EFSM, s2.send, 'asdf'.encode(), copy=copy)
54
55
 
55
56
        # I have to have this or we die on an Abort trap.
56
 
        msg1 = 'asdf'
 
57
        msg1 = 'asdf'.encode()
57
58
        msg2 = self.ping_pong(s1, s2, msg1)
58
59
        self.assertEquals(msg1, msg2)
59
60
 
60
61
    def test_json(self):
61
62
        s1, s2 = self.create_bound_pair(zmq.REQ, zmq.REP)
62
 
        o = dict(a=10,b=range(10))
 
63
        o = dict(a=10,b=list(range(10)))
63
64
        o2 = self.ping_pong_json(s1, s2, o)
64
65
 
65
66
    def test_pyobj(self):
69
70
 
70
71
    def test_large_msg(self):
71
72
        s1, s2 = self.create_bound_pair(zmq.REQ, zmq.REP)
72
 
        msg1 = 10000*'X'
 
73
        msg1 = 10000*'X'.encode()
73
74
 
74
75
        for i in range(10):
75
76
            msg2 = self.ping_pong(s1, s2, msg1)