# 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.
```
