Skip to content

Silence warning in tests when a translation was not a multiple of 3 - #5083

Merged
peterjc merged 1 commit into
biopython:masterfrom
peterjc:silence_warning_5031
Oct 21, 2025
Merged

peterjc merged 1 commit into
biopython:masterfrom
peterjc:silence_warning_5031

Conversation

@peterjc

@peterjc peterjc commented Oct 15, 2025

Copy link
Copy Markdown
Member
  • I hereby agree to dual licence this and any previous contributions under both
    the Biopython License Agreement AND the BSD 3-Clause License.

  • I have read the CONTRIBUTING.rst file, have run pre-commit
    locally, and understand that continuous integration checks will be used to
    confirm the Biopython unit tests and style checks pass with these changes.

  • I have added my name to the alphabetical contributors listings in the files
    NEWS.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

Testing locally:

❯ python test_SeqRecord.py
test_annotations (__main__.SeqRecordCreation.test_annotations)
...
test_ne_exception (__main__.SeqRecordMethodsMore.test_ne_exception) ... ok
test_no_side_effects (__main__.SeqRecordMethodsMore.test_no_side_effects) ... /Users/peterjc/miniforge3/envs/pyani-plus_py312/lib/python3.12/site-packages/Bio/Seq.py:2877: BiopythonWarning: Partial codon, len(sequence) not a multiple of three. Explicitly trim the sequence or add trailing N before translation. This may become an error in future.
  warnings.warn(
ok
test_reverse_complement_mutable_seq (__main__.SeqRecordMethodsMore.test_reverse_complement_mutable_seq) ... ok
test_reverse_complement_seq (__main__.SeqRecordMethodsMore.test_reverse_complement_seq) ... ok
test_translate (__main__.SeqRecordMethodsMore.test_translate) ... ok
test_defaults (__main__.TestTranslation.test_defaults) ... ok
test_new_annot (__main__.TestTranslation.test_new_annot) ... ok
test_preserve (__main__.TestTranslation.test_preserve) ... ok

----------------------------------------------------------------------
Ran 49 tests in 0.016s

OK

I think this warning is an oversight from #5031 and making the example length three is a good fix. @michaelfm1211 do you agree?

@codecov

codecov Bot commented Oct 15, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.31%. Comparing base (5216add) to head (629be68).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5083      +/-   ##
==========================================
+ Coverage   85.44%   86.31%   +0.87%     
==========================================
  Files         282      282              
  Lines       59443    59443              
==========================================
+ Hits        50789    51308     +519     
+ Misses       8654     8135     -519     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@michaelfm1211

Copy link
Copy Markdown
Contributor

Yes, I must have missed the warning when writing the test. Thanks for catching that!

@peterjc
peterjc merged commit 40bbed1 into biopython:master Oct 21, 2025
@peterjc
peterjc deleted the silence_warning_5031 branch October 21, 2025 13:33
@peterjc

peterjc commented Oct 21, 2025

Copy link
Copy Markdown
Member Author

Thanks, merged.

@peterjc peterjc mentioned this pull request Oct 21, 2025
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.

2 participants