Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brsnw250 committed Jul 30, 2024
1 parent c266594 commit dcdd47f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
14 changes: 13 additions & 1 deletion tests/test_transforms/test_inference/test_inverse_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
18 changes: 17 additions & 1 deletion tests/test_transforms/test_inference/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit dcdd47f

Please sign in to comment.