Ejemplo n.º 1
0
    def test_3to2(self, makegateway):
        python = _find_version("2")
        gw = makegateway("popen//python=%s" % python)

        ch = gw.remote_exec("channel.send(channel.receive());" * 2)
        ch.send(bytes("a", "ascii"))
        res = ch.receive()
        assert isinstance(res, str)

        ch.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False)

        ch.send("a")
        res = ch.receive()
        assert isinstance(res, bytes)

        gw.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False)
        ch = gw.remote_exec("channel.send(channel.receive());" * 2)

        ch.send("a")
        res = ch.receive()
        assert isinstance(res, bytes)

        ch.reconfigure(py3str_as_py2str=False, py2str_as_py3str=True)
        ch.send(bytes("a", "ascii"))
        res = ch.receive()
        assert isinstance(res, str)

        gw.exit()
Ejemplo n.º 2
0
    def test_3to2(self, makegateway):
        python = _find_version('2')
        gw = makegateway('popen//python=%s' % python)

        ch = gw.remote_exec('channel.send(channel.receive());'*2)
        ch.send(bytes('a', 'ascii'))
        res = ch.receive()
        assert isinstance(res, str)

        ch.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False)

        ch.send('a')
        res = ch.receive()
        assert isinstance(res, bytes)

        gw.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False)
        ch = gw.remote_exec('channel.send(channel.receive());'*2)

        ch.send('a')
        res = ch.receive()
        assert isinstance(res, bytes)

        ch.reconfigure(py3str_as_py2str=False, py2str_as_py3str=True)
        ch.send(bytes('a', 'ascii'))
        res = ch.receive()
        assert isinstance(res, str)

        gw.exit()
Ejemplo n.º 3
0
    def test_3to2(self, makegateway):
        python = _find_version('2')
        gw = makegateway('popen//python=%s' % python)

        ch = gw.remote_exec('channel.send(channel.receive());'*2)
        ch.send(bytes('a', 'ascii'))
        res = ch.receive()
        assert isinstance(res, str)

        ch.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False)

        ch.send('a')
        res = ch.receive()
        assert isinstance(res, bytes)

        gw.reconfigure(py3str_as_py2str=True, py2str_as_py3str=False)
        ch = gw.remote_exec('channel.send(channel.receive());'*2)

        ch.send('a')
        res = ch.receive()
        assert isinstance(res, bytes)

        ch.reconfigure(py3str_as_py2str=False, py2str_as_py3str=True)
        ch.send(bytes('a', 'ascii'))
        res = ch.receive()
        assert isinstance(res, str)

        gw.exit()