Skip to content

Fix cds() ignoring its length parameter#24

Merged
richarda23 merged 1 commit into
mainfrom
fix/23-cds-length-parameter
Mar 8, 2026
Merged

Fix cds() ignoring its length parameter#24
richarda23 merged 1 commit into
mainfrom
fix/23-cds-length-parameter

Conversation

@richarda23

Copy link
Copy Markdown
Owner

Summary

Fixes #23.

  • cds() had a hardcoded while i < 20: loop condition instead of while i < length:, so the length parameter was silently ignored and the method always returned a 20-codon sequence.
  • Added a regression test (test_cds_respects_length) that verifies the output length is correct for several different input values (5, 10, 50).

Test plan

  • test_cds_respects_length fails before the fix and passes after
  • Existing test_cds continues to pass (no regression)
  • Full test suite passes: poetry run python -m pytest faker_biology/tests

🤖 Generated with Claude Code

The loop condition was hardcoded as `while i < 20` instead of
`while i < length`, so cds() always produced a 20-codon sequence
regardless of the argument passed. Adds a regression test covering
multiple lengths.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@richarda23 richarda23 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine

@richarda23
richarda23 merged commit 934e58c into main Mar 8, 2026
5 checks passed
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: cds() ignores its length parameter due to hardcoded value

2 participants