<commit_before>import pytest

def test_zmq_get_version():
    from zmqpy._cffi import get_version

    version = get_version()

    assert version[0] in (2, 3)

def test_zmq_init():
    from zmqpy._cffi import C

    ctx = C.zmq_init(1)

    assert ctx
    ret = C.zmq_term(ctx)

def test_zmq_term():
    from zmqpy._cffi import C

    ctx = C.zmq_init(1)
    ret = C.zmq_term(ctx)

    assert ret == 0

def test_zmq_socket():
    from zmqpy._cffi import C
    from zmqpy.constants import PUSH

    ctx = C.zmq_init(1)
    socket = C.zmq_socket(ctx, PUSH)

    assert socket

def test_zmq_socket_close():
    from zmqpy._cffi import C
    from zmqpy.constants import PUSH

    ctx = C.zmq_init(1)
    socket = C.zmq_socket(ctx, PUSH)

    ret = C.zmq_close(socket)

    assert ret == 0

def test_zmq_setsockopt():
    from zmqpy._cffi import C, ffi
    from zmqpy.constants import PUSH, IDENTITY

    ctx = C.zmq_init(1)
    socket = C.zmq_socket(ctx, PUSH)

    identity = ffi.new('char[3]', 'zmq')
    ret = C.zmq_setsockopt(socket, IDENTITY, ffi.cast('void*', identity), 3)
    assert ret == 0

def test_zmq_getsockopt():
    from zmqpy._cffi import C, ffi
    from zmqpy.constants import PUSH, IDENTITY

    ctx = C.zmq_init(1)
    socket = C.zmq_socket(ctx, PUSH)

    identity = ffi.new('char[]', 'zmq')
    ret = C.zmq_setsockopt(socket, IDENTITY, ffi.cast('void*', identity), 3)
    assert ret == 0

    option_len = ffi.new('unsigned long*', 3)
    option = ffi.new('char*')
    ret = C.zmq_getsockopt(socket,
                           IDENTITY,
                           ffi.cast('void*', option),
                           option_len)

    assert ret == 0
    assert ffi.string(ffi.cast('char*', option))[0] == "z"
    assert ffi.string(ffi.cast('char*', option))[1] == "m"
    assert ffi.string(ffi.cast('char*', option))[2] == "q"

def test_zmq_bind_connect():
    from zmqpy.constants import PAIR

    ctx = C.zmq_init(1)
    socket1 = C.zmq_socket(ctx, PAIR)
    r1 = C.zmq_bind(socket1, 'tcp://*:5555')

    assert r1 == 0

def test_zmq_bind_connect():<commit_msg>minor test fix - change type<commit_after>import pytest

def test_zmq_get_version():
    from zmqpy._cffi import get_version

    version = get_version()

    assert version[0] in (2, 3)

def test_zmq_init():
    from zmqpy._cffi import C

    ctx = C.zmq_init(1)

    assert ctx
    ret = C.zmq_term(ctx)

def test_zmq_term():
    from zmqpy._cffi import C

    ctx = C.zmq_init(1)
    ret = C.zmq_term(ctx)

    assert ret == 0

def test_zmq_socket():
    from zmqpy._cffi import C
    from zmqpy.constants import PUSH

    ctx = C.zmq_init(1)
    socket = C.zmq_socket(ctx, PUSH)

    assert socket

def test_zmq_socket_close():
    from zmqpy._cffi import C
    from zmqpy.constants import PUSH

    ctx = C.zmq_init(1)
    socket = C.zmq_socket(ctx, PUSH)

    ret = C.zmq_close(socket)

    assert ret == 0

def test_zmq_setsockopt():
    from zmqpy._cffi import C, ffi
    from zmqpy.constants import PUSH, IDENTITY

    ctx = C.zmq_init(1)
    socket = C.zmq_socket(ctx, PUSH)

    identity = ffi.new('char[3]', 'zmq')
    ret = C.zmq_setsockopt(socket, IDENTITY, ffi.cast('void*', identity), 3)
    assert ret == 0

def test_zmq_getsockopt():
    from zmqpy._cffi import C, ffi
    from zmqpy.constants import PUSH, IDENTITY

    ctx = C.zmq_init(1)
    socket = C.zmq_socket(ctx, PUSH)

    identity = ffi.new('char[]', 'zmq')
    ret = C.zmq_setsockopt(socket, IDENTITY, ffi.cast('void*', identity), 3)
    assert ret == 0

    option_len = ffi.new('size_t*', 3)
    option = ffi.new('char*')
    ret = C.zmq_getsockopt(socket,
                           IDENTITY,
                           ffi.cast('void*', option),
                           option_len)

    assert ret == 0
    assert ffi.string(ffi.cast('char*', option))[0] == "z"
    assert ffi.string(ffi.cast('char*', option))[1] == "m"
    assert ffi.string(ffi.cast('char*', option))[2] == "q"

def test_zmq_bind_connect():
    from zmqpy.constants import PAIR

    ctx = C.zmq_init(1)
    socket1 = C.zmq_socket(ctx, PAIR)
    r1 = C.zmq_bind(socket1, 'tcp://*:5555')

    assert r1 == 0

def test_zmq_bind_connect():
{'fraction_non_alphanumeric': 0.12961188308576904, 'fraction_numerical': 0.014853857211308098, 'mean_word_length': 2.7078152753108347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2742056', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1632, 'n_words': 364}