-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove the older (uglier) test suite for algos
Signed-off-by: Fabrice Normandin <[email protected]>
- Loading branch information
Showing
7 changed files
with
221 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
from typing import ClassVar | ||
|
||
import torch | ||
|
||
from project.algorithms.testsuites.classification_tests import ClassificationAlgorithmTests | ||
from project.algorithms.testsuites.algorithm_tests import LearningAlgorithmTests | ||
from project.datamodules.image_classification.image_classification import ( | ||
ImageClassificationDataModule, | ||
) | ||
from project.utils.testutils import run_for_all_configs_of_type | ||
|
||
from .example import ExampleAlgorithm | ||
|
||
|
||
class TestExampleAlgorithm(ClassificationAlgorithmTests[ExampleAlgorithm]): | ||
algorithm_type = ExampleAlgorithm | ||
unsupported_datamodule_names: ClassVar[list[str]] = ["rl"] | ||
_supported_network_types: ClassVar[list[type]] = [torch.nn.Module] | ||
@run_for_all_configs_of_type("datamodule", ImageClassificationDataModule) | ||
@run_for_all_configs_of_type("network", torch.nn.Module) | ||
class TestExampleAlgo(LearningAlgorithmTests[ExampleAlgorithm]): | ||
"""Tests for the `ExampleAlgorithm`. | ||
See `LearningAlgorithmTests` for more information on the built-in tests. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
from typing import ClassVar | ||
|
||
import flax | ||
import flax.linen | ||
import torch | ||
import pytest | ||
|
||
from project.algorithms.jax_example import JaxExample | ||
from project.datamodules.image_classification.image_classification import ( | ||
ImageClassificationDataModule, | ||
) | ||
from project.utils.testutils import run_for_all_configs_of_type | ||
|
||
from .testsuites.algorithm_tests import AlgorithmTests | ||
|
||
from .testsuites.algorithm_tests import LearningAlgorithmTests | ||
|
||
class TestJaxExample(AlgorithmTests[JaxExample]): | ||
"""This algorithm only works with Jax modules.""" | ||
|
||
unsupported_network_types: ClassVar[list[type]] = [torch.nn.Module] | ||
_supported_network_types: ClassVar[list[type]] = [flax.linen.Module] | ||
@pytest.mark.timeout(10) | ||
@run_for_all_configs_of_type("datamodule", ImageClassificationDataModule) | ||
@run_for_all_configs_of_type("network", flax.linen.Module) | ||
class TestJaxExample(LearningAlgorithmTests[JaxExample]): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.