Skip to content

Conversation

@hyanwong
Copy link
Member

Fixes #2091

@codecov
Copy link

codecov bot commented Jun 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.63%. Comparing base (abe75c2) to head (d7f2270).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3210   +/-   ##
=======================================
  Coverage   89.63%   89.63%           
=======================================
  Files          28       28           
  Lines       32000    32004    +4     
  Branches     5877     5879    +2     
=======================================
+ Hits        28684    28688    +4     
  Misses       1886     1886           
  Partials     1430     1430           
Flag Coverage Δ
c-tests 86.66% <ø> (ø)
lwt-tests 80.38% <ø> (ø)
python-c-tests 88.18% <ø> (ø)
python-tests 98.86% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
python/tskit/tables.py 99.35% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hyanwong
Copy link
Member Author

I added an extra commit to this as I was documenting the error returns, as it was easier to make the trim() commands do the right thing with migrations than figure out how to word the description of when the error message was triggered!

Copy link
Member

@benjeffery benjeffery left a comment

Choose a reason for hiding this comment

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

Couple of comments, needs a changelog.

:param bool record_provenance: If ``True``, add details of this operation
to the provenance table in this TableCollection. (Default: ``True``).
:raises ValueError: If the TableCollection has no edges, has a reference sequence
or has migrations that extend into the trimmed regions.
Copy link
Member

Choose a reason for hiding this comment

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

This line is no longer true?


def test_failure_with_migrations(self):
def test_migration_trimming(self):
# All trim functions fail if migrations extend further than rightmost or
Copy link
Member

Choose a reason for hiding this comment

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

This comment is now orphaned.

@jeromekelleher
Copy link
Member

These tests for migrations don't look very comprehensive to me - can we switch back to raising an error if we're not going to put the effort in to doing things properly? It is much better to not implement something (particularly if it's very unlikely to be used) that to do it badly and introduce bugs for others to trace down and fix later.

@hyanwong
Copy link
Member Author

can we switch back to raising an error if we're not going to put the effort in to doing things properly?

I can revert the second commit. It seemed easier to deal with this than document the exceptions, that's all. And I assume we will fix this post-1.0?

@jeromekelleher
Copy link
Member

I can revert the second commit. It seemed easier to deal with this than document the exceptions, that's all. And I assume we will fix this post-1.0?

We don't need to document the exceptions, that's what the error message is for. This is a remote corner of the API that like as not no one will ever use. If they do, the will hit the error and they can open an issue asking for it to be implemented. A poorly tested implementation is much worse than this.

@hyanwong
Copy link
Member Author

hyanwong commented Jun 11, 2025

OK, reverted to first commit, removed description of exceptions (I thought we had started wanting to do this though?) and added changelog.

@jeromekelleher
Copy link
Member

I don't think we need to get too particular about writing documentation for every corner case and combination of features that are and are not implemented together - a descriptive error message is much more helpful.

@benjeffery benjeffery added this pull request to the merge queue Jun 11, 2025
Merged via the queue into tskit-dev:main with commit 1c83828 Jun 11, 2025
19 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.

How do reference sequences deal with trimming etc.

3 participants