def METHOD_NAME(self):
    """Test write single coil."""
    context = MockContext(False, default=True)
    request = WriteSingleCoilRequest(2, True)
    result = request.execute(context)
    assert result.exception_code == ModbusExceptions.IllegalAddress
    context.valid = True
    result = request.execute(context)
    assert result.encode() == b"\x00\x02\xff\x00"
    context = MockContext(True, default=False)
    request = WriteSingleCoilRequest(2, False)
    result = request.execute(context)
    assert result.encode() == b"\x00\x02\x00\x00"