Skip to content

Example test

Example showing how the test suite can be used to add tests for a new algorithm.

TestExampleAlgo #

Bases: LearningAlgorithmTests[ExampleAlgorithm]

Tests for the ExampleAlgorithm.

This runs all the tests included in the base class, with the given parametrizations:

  • algorithm_config will take the value "example"
    • This is because there is an example.yaml config file whose _target_ is the ExampleAlgorithm.
  • datamodule_config will take these values: ['cifar10', 'fashion_mnist', 'imagenet', 'imagenet32', 'inaturalist', 'mnist']
    • These are all the configs whose target is an ImageClassificationDataModule.
  • Similarly, network_config will be parametrized by the names of all configs which produce an nn.Module.

Take a look at the LearningAlgorithmTests class if you want to see the actual test code.

test_example_experiment_defaults #

test_example_experiment_defaults(
    experiment_config: Config,
) -> None

Test to check that the datamodule is required (even when just an algorithm is set?!).