From 81bf5d2b2d3bfe87f8cb42ec4279b42534bf399a Mon Sep 17 00:00:00 2001 From: Igor Trujnara Date: Wed, 29 Jan 2025 15:57:59 +0100 Subject: [PATCH] test (typing): Add tests for typing. Add tests for the typing module. --- tests/typing/__init__.py | 1 + tests/typing/test_typing.py | 94 +++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 tests/typing/__init__.py create mode 100644 tests/typing/test_typing.py diff --git a/tests/typing/__init__.py b/tests/typing/__init__.py new file mode 100644 index 00000000..a987b788 --- /dev/null +++ b/tests/typing/__init__.py @@ -0,0 +1 @@ +"""Test directory for the typing module.""" diff --git a/tests/typing/test_typing.py b/tests/typing/test_typing.py new file mode 100644 index 00000000..fed2f568 --- /dev/null +++ b/tests/typing/test_typing.py @@ -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")