# @tensorleap\_integration\_test

The tensorleap\_integration\_test decorates Tensorleap's [integration test](/tensorleap-integration/integration-test.md), and is used to instruct the platform on what code interfaces should be used when analyzing your model and to locally test the validity of a Tensorleap integration script.

```python
@tensorleap_integration_test()
def integration_test(idx: int, subset: PreprocessResponse) -> None:
    pass
```

### Examples

#### Basic Usage

```python
from code_loader.plot_functions.visualize import visualize
from code_loader.inner_leap_binder.leapbinder_decorators import tensorleap_integration_test

# Import your integration functions (defined in your integration script)
from leap_integration import (
    preprocess_func, input_encoder, gt_encoder,
    image_visualizer, my_metric, my_loss, load_model
)

@tensorleap_integration_test()
def integration_test(idx, subset):
    image = input_encoder(idx, subset)
    gt = gt_encoder(idx, subset)

    model = load_model()
    y_pred = model([image])

    img_vis = image_visualizer(image)
    visualize(img_vis)

    metric_res = my_metric(gt, y_pred)
    loss_res = my_loss(gt, y_pred)
    print(metric_res, loss_res)


if __name__ == '__main__':
    train, val, *_ = preprocess_func()
    for i in range(3):
        integration_test(i, train)
        integration_test(i, val)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/decorators/tensorleap_integration_test.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
