Skip to content

Commit

Permalink
test (typing): Add tests for typing.
Browse files Browse the repository at this point in the history
Add tests for the typing module.
  • Loading branch information
itrujnara committed Jan 29, 2025
1 parent 8f82101 commit 81bf5d2
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/typing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Test directory for the typing module."""
94 changes: 94 additions & 0 deletions tests/typing/test_typing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
"""The test suite for the typing module.
As the typing module only contains types, the tests only check imports.
"""
# ruff: noqa: F401

import pytest


def test_analysis_types() -> None:
"""Test the analysis types."""
try:
from stimulus.typing import Analysis, AnalysisPerformanceTune, AnalysisRobustness
except ImportError:
pytest.fail("Failed to import Analysis types")


def test_data_handlers_types() -> None:
"""Test the data handlers types."""
try:
from stimulus.typing import (
DatasetHandler,
DatasetLoader,
DatasetManager,
DatasetProcessor,
EncodeManager,
SplitManager,
TransformManager,
)
except ImportError:
pytest.fail("Failed to import Data Handlers types")


def test_learner_types() -> None:
"""Test the learner types."""
try:
from stimulus.typing import (
PredictWrapper,
RayTuneMetrics,
RayTuneOptimizer,
RayTuneResult,
TuneModel,
TuneParser,
TuneWrapper,
)
except ImportError:
pytest.fail("Failed to import Learner types")


def test_yaml_data_types() -> None:
"""Test the YAML data types."""
try:
from stimulus.typing import (
YamlColumns,
YamlColumnsEncoder,
YamlConfigDict,
YamlGlobalParams,
YamlSchema,
YamlSplit,
YamlSubConfigDict,
YamlTransform,
YamlTransformColumns,
YamlTransformColumnsTransformation,
)
except ImportError:
pytest.fail("Failed to import YAML Data types")


def test_yaml_model_schema_types() -> None:
"""Test the YAML model schema types."""
try:
from stimulus.typing import (
CustomTunableParameter,
Data,
Loss,
Model,
RayTuneModel,
RunParams,
Scheduler,
TunableParameter,
Tune,
TuneParams,
YamlRayConfigLoader,
)
except ImportError:
pytest.fail("Failed to import YAML Model Schema types")


def test_type_aliases() -> None:
"""Test the type aliases."""
try:
from stimulus.typing import DataManager, Loader, RayTuneData, YamlData
except ImportError:
pytest.fail("Failed to import Type Aliases")

0 comments on commit 81bf5d2

Please sign in to comment.