From dcdd47faaafc93d0b8669f6b8258e062fb3bf36a Mon Sep 17 00:00:00 2001 From: brsnw250 Date: Tue, 30 Jul 2024 14:25:22 +0300 Subject: [PATCH] added tests --- .../test_inference/test_inverse_transform.py | 14 +++++++++++++- .../test_inference/test_transform.py | 18 +++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/tests/test_transforms/test_inference/test_inverse_transform.py b/tests/test_transforms/test_inference/test_inverse_transform.py index 56dd7c9fa..f734df2c7 100644 --- a/tests/test_transforms/test_inference/test_inverse_transform.py +++ b/tests/test_transforms/test_inference/test_inverse_transform.py @@ -2595,7 +2595,6 @@ def _test_inverse_transform_future_with_target( "regular_ts", {}, ), - # (FourierDecomposeTransform(in_column="target", k=5, residuals=True), "regular_ts", {}), # embeddings ( EmbeddingSegmentTransform( @@ -2993,6 +2992,19 @@ def test_inverse_transform_future_with_target_fail_difference( with pytest.raises(ValueError, match="Test should go after the train without gaps"): self._test_inverse_transform_future_with_target(ts, transform, expected_changes=expected_changes) + @pytest.mark.parametrize( + "transform, dataset_name, expected_changes", + [ + (FourierDecomposeTransform(in_column="target", k=5, residuals=True), "regular_ts", {}), + ], + ) + def test_inverse_transform_future_with_target_fail_require_history( + self, transform, dataset_name, expected_changes, request + ): + ts = request.getfixturevalue(dataset_name) + with pytest.raises(ValueError, match="Dataset to be transformed must contain historical observations"): + self._test_inverse_transform_future_with_target(ts, transform, expected_changes=expected_changes) + # It is the only transform that doesn't change values back during `inverse_transform` @to_be_fixed(raises=AssertionError) @pytest.mark.parametrize( diff --git a/tests/test_transforms/test_inference/test_transform.py b/tests/test_transforms/test_inference/test_transform.py index a3c15ed6e..234d568db 100644 --- a/tests/test_transforms/test_inference/test_transform.py +++ b/tests/test_transforms/test_inference/test_transform.py @@ -2434,7 +2434,6 @@ def _test_transform_future_with_target(self, ts, transform, expected_changes, ga "regular_ts", {"create": {"res"}}, ), - # (FourierDecomposeTransform(in_column="target", k=2, residuals=True), "regular_ts", {"create": {"target_dft_0", "target_dft_1", "target_dft_residuals"}}), # embeddings ( EmbeddingSegmentTransform( @@ -2801,6 +2800,23 @@ def test_transform_future_with_target(self, transform, dataset_name, expected_ch ts = request.getfixturevalue(dataset_name) self._test_transform_future_with_target(ts, transform, expected_changes=expected_changes) + @pytest.mark.parametrize( + "transform, dataset_name, expected_changes", + ( + ( + FourierDecomposeTransform(in_column="target", k=2, residuals=True), + "regular_ts", + {"create": {"target_dft_0", "target_dft_1", "target_dft_residuals"}}, + ), + ), + ) + def test_transform_future_with_target_fail_require_history( + self, transform, dataset_name, expected_changes, request + ): + ts = request.getfixturevalue(dataset_name) + with pytest.raises(ValueError, match="Dataset to be transformed must contain historical observations"): + self._test_transform_future_with_target(ts, transform, expected_changes=expected_changes) + class TestTransformFutureWithoutTarget: """Test transform on future dataset with unknown target.