[BUG] Fix GreedyEncoder max_len type hint and add tests (#376)#378
Open
sohamjadhav95 wants to merge 1 commit intogc-os-ai:mainfrom
Open
[BUG] Fix GreedyEncoder max_len type hint and add tests (#376)#378sohamjadhav95 wants to merge 1 commit intogc-os-ai:mainfrom
sohamjadhav95 wants to merge 1 commit intogc-os-ai:mainfrom
Conversation
Author
|
@NennoMP @siddharth7113 PR #378 is ready for review. |
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.
Reference Issues/PRs
Fixes #376
What does this implement/fix? Explain your changes.
GreedyEncoder.__init__hadmax_lendefined as a requiredintargument with no default, but the docstring describes it as optional with a default ofNone, and_transformalready has handling for theNonecase. This mismatch meantget_test_params()was broken —param0doesn't includemax_len, so trying to instantiateGreedyEncoder(**param0)raised aTypeError.Fix is a one-line change:
max_len: int→max_len: int | None = None, making the signature consistent with the existing docstring and implementation.What should a reviewer concentrate their feedback on?
__init__— making sureint | None = Noneis the right approach vs addingmax_lentoparam0insteadget_test_paramsinstantiation,max_len=Nonedefault behavior, truncation, padding, and unknown token handlingDid you add any tests for the change?
Yes. Created
pyaptamer/trafos/encode/tests/test_greedy_encoder.pyfrom scratch — no tests existed forGreedyEncoderbefore this PR. Added 5 tests covering the main behaviors.Any other comments?
Found this while going through the
trafosmodule. TheGreedyEncoderhad no test file at all, so added coverage for the core functionality alongside the fix.PR checklist