from execnet import gateway_base


def test_opcodes():
    data = vars(gateway_base.opcode)
    computed = dict((k, v) for k, v in data.items() if '__' not in k)
    assert computed == {
        'BUILDTUPLE': '@',
        'BYTES': 'A',
        'CHANNEL': 'B',
        'FALSE': 'C',
        'FLOAT': 'D',
        'FROZENSET': 'E',
        'INT': 'F',
        'LONG': 'G',
        'LONGINT': 'H',
        'LONGLONG': 'I',
        'NEWDICT': 'J',
        'NEWLIST': 'K',
        'NONE': 'L',
        'PY2STRING': 'M',
        'PY3STRING': 'N',
        'SET': 'O',
        'SETITEM': 'P',
        'STOP': 'Q',
        'TRUE': 'R',
        'UNICODE': 'S',

        # added in 1.4
        # causes a regression since it was ordered in
        # between CHANNEL and FALSE as "C" moving the other items
        'COMPLEX': 'T',
    }

from execnet import gateway_base


def test_opcodes():
    data = vars(gateway_base.opcode)
    computed = dict((k, v) for k, v in data.items() if '__' not in k)
    assert computed == {
        'BUILDTUPLE': '@'.encode('ascii'),
        'BYTES': 'A'.encode('ascii'),
        'CHANNEL': 'B'.encode('ascii'),
        'FALSE': 'C'.encode('ascii'),
        'FLOAT': 'D'.encode('ascii'),
        'FROZENSET': 'E'.encode('ascii'),
        'INT': 'F'.encode('ascii'),
        'LONG': 'G'.encode('ascii'),
        'LONGINT': 'H'.encode('ascii'),
        'LONGLONG': 'I'.encode('ascii'),
        'NEWDICT': 'J'.encode('ascii'),
        'NEWLIST': 'K'.encode('ascii'),
        'NONE': 'L'.encode('ascii'),
        'PY2STRING': 'M'.encode('ascii'),
        'PY3STRING': 'N'.encode('ascii'),
        'SET': 'O'.encode('ascii'),
        'SETITEM': 'P'.encode('ascii'),
        'STOP': 'Q'.encode('ascii'),
        'TRUE': 'R'.encode('ascii'),
        'UNICODE': 'S'.encode('ascii'),

        # added in 1.4
        # causes a regression since it was ordered in
        # between CHANNEL and FALSE as "C" moving the other items
        'COMPLEX': 'T'.encode('ascii'),
    }

fix the serializer regression test on python3