Skip to content

[BUG] Raise ValueError for invalid return_type in encode_rna#567

Open
Alleny244 wants to merge 1 commit into
gc-os-ai:mainfrom
Alleny244:fix/encode-rna-validate-return-type
Open

[BUG] Raise ValueError for invalid return_type in encode_rna#567
Alleny244 wants to merge 1 commit into
gc-os-ai:mainfrom
Alleny244:fix/encode-rna-validate-return-type

Conversation

@Alleny244

@Alleny244 Alleny244 commented Apr 29, 2026

Copy link
Copy Markdown

Reference Issues/PRs

Fixes #566

What does this implement/fix? Explain your changes.

encode_rna() silently accepted invalid return_type values, leading to unexpected behavior downstream. This PR adds an upfront validation check that raises a ValueError with a clear message when return_type is not one of the supported values ("tensor" or "numpy"). The docstring is also updated to explicitly state the valid options.

What should a reviewer concentrate their feedback on?

  • Whether the validation placement (before any processing) is appropriate
  • Whether the error message is clear and actionable
  • Whether the test parametrization covers sufficient edge cases (e.g. case sensitivity, empty string)

Did you add any tests for the change?

Yes:

  • test_encode_rna_invalid_return_type — parametrized test verifying ValueError is raised for invalid inputs ("list", "array", "", "TENSOR", "Numpy")
  • test_encode_rna_numpy_return_type — verifies the "numpy" return path produces an np.ndarray

Any other comments?

PR checklist

  • The PR title starts with either [ENH], [MNT], [DOC], or [BUG]. [BUG] - bugfix, [MNT] - CI, test framework, [ENH] - adding or improving code, [DOC] - writing or improving documentation or docstrings.
  • Added/modified tests
  • Used pre-commit hooks when committing to ensure that code is compliant with hooks. Install hooks with pre-commit install.
    To run hooks independent of commit, execute pre-commit run --all-files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] encode_rna silently accepts invalid return_type values

1 participant