<commit_before>import platform

import pynetsnmp

from .fixtures import sess_v3  # noqa


def test_pynetsnmp_v3_session_get(sess_v3):  # noqa
    res = sess_v3.get([
        ('sysUpTime', 0),
        ('sysContact', 0),
        ('sysLocation', 0)
    ])

    assert len(res) == 3

    assert res[0].snmp_oid == 'sysUpTimeInstance'
    assert res[0].snmp_oid_index is None
    assert res[0] > 0
    assert res[0].snmp_type == 'TICKS'

    assert res[1].snmp_oid == 'sysContact'
    assert res[1].snmp_oid_index == 0
    assert res[1] == '<NAME> <<EMAIL>>'
    assert res[1].snmp_type == 'OCTETSTR'

    assert res[2].snmp_oid == 'sysLocation'
    assert res[2].snmp_oid_index == 0
    assert res[2] == 'my even newer location'
    assert res[2].snmp_type == 'OCTETSTR'


def test_pynetsnmp_v3_session_get_next(sess_v3):  # noqa
    res = sess_v3.get_next([
        ('sysUpTime', 0),
        ('sysContact', 0),
        ('sysLocation', 0)
    ])

    assert len(res) == 3

    assert res[0].snmp_oid == 'sysContact'
    assert res[0].snmp_oid_index == 0
    assert res[0] == '<NAME> <<EMAIL>>'
    assert res[0].snmp_type == 'OCTETSTR'

    assert res[1].snmp_oid == 'sysName'
    assert res[1].snmp_oid_index == 0
    assert res[1] == platform.node()
    assert res[1].snmp_type == 'OCTETSTR'

    assert res[2].snmp_oid == 'sysORLastChange'
    assert res[2].snmp_oid_index == 0
    assert res[2] > 0
    assert res[2].snmp_type == 'TICKS'


def test_pynetsnmp_v3_session_get_bulk(sess_v3):  # noqa
    res = sess_v3.get_bulk(
        ['sysUpTime', 'sysORLastChange', 'sysORID', 'sysORDescr',
         'sysORUpTime'], 2, 8
    )

    assert len(res) == 26

    assert res[0].snmp_oid == 'sysUpTimeInstance'
    assert res[0].snmp_oid_index is None
    assert res[0] > 0
    assert res[0].snmp_type == 'TICKS'

    assert res[4].snmp_oid == 'sysORUpTime'
    assert res[4].snmp_oid_index == 1
    assert res[4] > 0
    assert res[4].snmp_type == 'TICKS'


def test_pynetsnmp_v3_session_set(sess_v3):  # noqa
    success = sess_v3.set(('sysLocation', 0), 'my final destination')
    assert success

    res = pynetsnmp.snmp_get(<commit_msg>Corrected two tests which failed to run on different OSs<commit_after>import platform

import pynetsnmp

from .fixtures import sess_v3  # noqa


def test_pynetsnmp_v3_session_get(sess_v3):  # noqa
    res = sess_v3.get([
        ('sysUpTime', 0),
        ('sysContact', 0),
        ('sysLocation', 0)
    ])

    assert len(res) == 3

    assert res[0].snmp_oid == 'sysUpTimeInstance'
    assert res[0].snmp_oid_index is None
    assert res[0] > 0
    assert res[0].snmp_type == 'TICKS'

    assert res[1].snmp_oid == 'sysContact'
    assert res[1].snmp_oid_index == 0
    assert res[1] == '<NAME> <<EMAIL>>'
    assert res[1].snmp_type == 'OCTETSTR'

    assert res[2].snmp_oid == 'sysLocation'
    assert res[2].snmp_oid_index == 0
    assert res[2] == 'my even newer location'
    assert res[2].snmp_type == 'OCTETSTR'


def test_pynetsnmp_v3_session_get_next(sess_v3):  # noqa
    res = sess_v3.get_next([
        ('sysUpTime', 0),
        ('sysContact', 0),
        ('sysLocation', 0)
    ])

    assert len(res) == 3

    assert res[0].snmp_oid == 'sysContact'
    assert res[0].snmp_oid_index == 0
    assert res[0] == '<NAME> <<EMAIL>>'
    assert res[0].snmp_type == 'OCTETSTR'

    assert res[1].snmp_oid == 'sysName'
    assert res[1].snmp_oid_index == 0
    assert res[1] == platform.node()
    assert res[1].snmp_type == 'OCTETSTR'

    assert res[2].snmp_oid == 'sysORLastChange'
    assert res[2].snmp_oid_index == 0
    assert res[2] => 0
    assert res[2].snmp_type == 'TICKS'


def test_pynetsnmp_v3_session_get_bulk(sess_v3):  # noqa
    res = sess_v3.get_bulk(
        ['sysUpTime', 'sysORLastChange', 'sysORID', 'sysORDescr',
         'sysORUpTime'], 2, 8
    )

    assert len(res) == 26

    assert res[0].snmp_oid == 'sysUpTimeInstance'
    assert res[0].snmp_oid_index is None
    assert res[0] > 0
    assert res[0].snmp_type == 'TICKS'

    assert res[4].snmp_oid == 'sysORUpTime'
    assert res[4].snmp_oid_index == 1
    assert res[4] >= 0
    assert res[4].snmp_type == 'TICKS'


def test_pynetsnmp_v3_session_set(sess_v3):  # noqa
    success = sess_v3.set(('sysLocation', 0), 'my final destination')
    assert success

    res = pynetsnmp.snmp_get(
{'fraction_non_alphanumeric': 0.14547139217048877, 'fraction_numerical': 0.031503358813991196, 'mean_word_length': 3.1760154738878144, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, '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': '1728084', 'n_tokens_mistral': 1781, 'n_tokens_neox': 1682, 'n_words': 344}