<commit_before>from droneapi.lib import VehicleMode
from pymavlink import mavutil
import time
import sys
import os

def test_115(local_connect):
    api = local_connect()
    v = api.get_vehicles()[0]

    # Dummy callback
    def noop(*args):
        pass

    # Set the callback.
    v.set_mavlink_callback(noop)
    
    # Change the vehicle into STABILIZE mode
    v.mode = VehicleMode("STABILIZE")

    # NOTE wait crudely for ACK on mode update
    time.sleep(3)

    # Unset the callback.
    v.set_mavlink_callback(None)

    # Disarm should not throw errors.
    v.armed = False
    v.flush()

    time.sleep(3)

    # Re-arm should not throw errors.
    v.armed = True
    v.flush()

    time.sleep(3)<commit_msg>Updates test_115 to use unset_mavlink_callback and stricter checks<commit_after>from droneapi.lib import VehicleMode
from pymavlink import mavutil
import time
import sys
import os
from testlib import assert_equals

def test_115(local_connect):
    api = local_connect()
    v = api.get_vehicles()[0]

    # Dummy callback
    def mavlink_callback(*args):
        mavlink_callback.count += 1
    mavlink_callback.count = 0

    # Set the callback.
    v.set_mavlink_callback(mavlink_callback)

    # Change the vehicle into STABILIZE mode
    v.mode = VehicleMode("STABILIZE")
    # NOTE wait crudely for ACK on mode update
    time.sleep(3)

    # Expect the callback to have been called
    assert mavlink_callback.count > 0

    # Unset the callback.
    v.unset_mavlink_callback()
    savecount = mavlink_callback.count

    # Disarm. A callback of None should not throw errors
    v.armed = False
    v.flush()
    # NOTE wait crudely for ACK on mode update
    time.sleep(3)

    # Expect the callback to have been called
    assert_equals(savecount, mavlink_callback.count)

    # Re-arm should not throw errors.
    v.armed = True
    v.flush()
    # NOTE wait crudely for ACK on mode update
    time.sleep(3)
{'fraction_non_alphanumeric': 0.073749355337803, 'fraction_numerical': 0.010314595152140279, 'mean_word_length': 2.9430894308943087, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '7450380', 'n_tokens_mistral': 659, 'n_tokens_neox': 621, 'n_words': 190}