test: pin TFTInstanceSplitter observed_value_field=None branch (#3296 item 3) - #3299
Open
jbbqqf wants to merge 1 commit into
Open
test: pin TFTInstanceSplitter observed_value_field=None branch (#3296 item 3)#3299jbbqqf wants to merge 1 commit into
jbbqqf wants to merge 1 commit into
Conversation
awslabs#3259 made `observed_value_field` optional in TFTInstanceSplitter but did not add a test exercising the new None branch — the umbrella follow-up awslabs#3296 (item 3) flags this as a regression-test gap. Add a parametrized test covering both branches: - `observed_value_field=None`: splitter must not look up an observed-values array on the entry, and output must contain neither `past_observed_values` nor `observed_values`. - `observed_value_field=FieldName.OBSERVED_VALUES`: the existing default-like behaviour still emits `past_observed_values` of the configured length. Refs awslabs#3296
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: refs #3296 (item 3)
Description of changes:
Summary
Add a regression test pinning the
observed_value_field=Nonebranch ofTFTInstanceSplitter, introduced by #3259 but not covered by the test suite.Context
#3296 enumerates regression-test gaps left by recent merged PRs. Item 3:
grep -rn TFTInstanceSplitter test/confirms there were zero direct tests for this class. Without a test, a future refactor could regress theNonebranch silently — theflatmap_transformmethod only branches onif self.observed_value_field is not None:(src/gluonts/transform/split.py:533-534), and the integration tests intest/torch/model/test_estimators.pyonly exercise the default field-name path.Changes
test/transform/test_transform.py: addtest_TFTInstanceSplitter_observed_value_field_optional, apytest.parametrizeover[None, FieldName.OBSERVED_VALUES]that:datadict usingTestSplitSampler.past_targetalways has the configuredpast_length.Nonebranch emits neitherobserved_valuesnorpast_observed_values, and does not require the entry to carry an observed-values array.past_observed_valueswith the right length.A short docstring on the test cites #3259 and #3296 so a reviewer reading the test cold sees the regression it guards.
Reproduce BEFORE/AFTER yourself (copy-paste)
What I ran locally
pytest test/transform/test_transform.py -q→ 252 passed, 4 skipped on the branch (was 250 + 4 on dev; +2 from this PR).pytest test/transform/test_transform.py -q -k TFTInstanceSplitter→ 2 passed.Edge cases tested
observed_value_field=Noneobserved_values/past_observed_valueskeystest_TFTInstanceSplitter_observed_value_field_optional[None]observed_value_field=FieldName.OBSERVED_VALUESobserved_valuesmaskpast_observed_valuesof lengthpast_lengthtest_TFTInstanceSplitter_observed_value_field_optional[observed_values]Risk / blast radius
Test-only addition. Zero runtime impact.
Release note
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Please tag this pr with at least one of these labels to make our release process faster: BREAKING, new feature, bug fix, other change, dev setup
PR drafted with assistance from Claude Code. The reproducer block above was used during development and is the same one a reviewer can paste verbatim.