# Testing your code

**The crunch test command allows you to perform a local test of your code, on the public test set provided by the organizer. This test set is purposefully very small and will not be taken into account for the scoring on the public leaderboard.**

```python
# Run a local test in a notebook
crunch.test(force_first_train=True, train_frequency=2)
```

```sh
# Run a local test in your terminal
crunch test --no-force-first-train --train-frequency 2
```

* This function of the crunch package will run your code locally, simulating how it is called in the cloud&#x20;
* You can set up the retraining frequency as you wish&#x20;
* A training frequency of 2 means that the system will retrain your model every two dates&#x20;
* In a notebook,`force_first_train=True` indicates that your model will be trained on the first date of the test set
* Similarly, `--no-force-first-train` controls the same parameter for terminal calls to the function (Note that in this case, using this flag will do the opposite as  `force_first_train=True` in the notebook case)

```
Usage: crunch test [OPTIONS]

  Test your code locally.

Options:
  -m, --main-file TEXT       Entrypoint of your code.  [default: main.py]
  --model-directory TEXT     Directory where your model is stored.  [default:
                             resources]

  --no-force-first-train     Do not force the train at the first loop.
  --train-frequency INTEGER  Train interval.  [default: 1]
  --help                     Show this message and exit.
```


---

# 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.adialab.crunchdao.com/participate/testing-your-code.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.
