Skip to content

Assert equal for tables and collections #1328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 29, 2021

Conversation

benjeffery
Copy link
Member

WIP - Tables are done, Table Collection has a few options that I'm working on.

Fixes #1076

@benjeffery benjeffery force-pushed the assert_equal branch 5 times, most recently from 061aaf5 to 16ee033 Compare April 25, 2021 22:21
@benjeffery benjeffery marked this pull request as ready for review April 25, 2021 22:36
@benjeffery
Copy link
Member Author

@petrelharp as JK is away can I get a review here?

@benjeffery
Copy link
Member Author

benjeffery commented Apr 26, 2021

@Mergifyio rebase

@benjeffery
Copy link
Member Author

@Mergifyio rebase

@mergify
Copy link
Contributor

mergify bot commented Apr 26, 2021

Command rebase: success

Branch has been successfully rebased

@benjeffery benjeffery requested a review from petrelharp April 28, 2021 08:48
@tskit-dev tskit-dev deleted a comment from codecov bot Apr 28, 2021
@benjeffery
Copy link
Member Author

Coverage isn't updating for some reason.

@codecov
Copy link

codecov bot commented Apr 28, 2021

Codecov Report

Merging #1328 (0ef4d4f) into main (4f53216) will decrease coverage by 0.00%.
The diff coverage is 88.70%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1328      +/-   ##
==========================================
- Coverage   93.84%   93.84%   -0.01%     
==========================================
  Files          26       26              
  Lines       22273    22335      +62     
  Branches     1029     1053      +24     
==========================================
+ Hits        20903    20961      +58     
- Misses       1339     1340       +1     
- Partials       31       34       +3     
Flag Coverage Δ
c-tests 92.44% <ø> (ø)
lwt-tests 92.97% <ø> (ø)
python-c-tests 95.18% <88.70%> (-0.01%) ⬇️
python-tests 98.79% <88.70%> (-0.12%) ⬇️

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

Impacted Files Coverage Δ
python/tskit/tables.py 98.86% <88.70%> (-0.86%) ⬇️
python/_tskitmodule.c 91.57% <0.00%> (+0.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4f53216...0ef4d4f. Read the comment docs.


def test_equal(self, table1, test_rows):
table2 = self.table_class()
for row in test_rows[:5]:
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this depending on the number of rows being 5? e.g., shouldn't you replace 5 with table1.num_rows?

Copy link
Member Author

Choose a reason for hiding this comment

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

The tables have a fix number of rows (10).


def test_num_rows(self, table1, test_rows):
table2 = self.table_class()
for row in test_rows[:4]:
Copy link
Contributor

Choose a reason for hiding this comment

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

4 -> table1.num_rows - 1?

table2.add_row(**row)
with pytest.raises(
AssertionError,
match=f"{type(table1).__name__} number of rows differ: self=5 other=4",
Copy link
Contributor

Choose a reason for hiding this comment

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

oh I see, many things are depending on the number 5. perhaps it's OK.

Copy link
Contributor

@petrelharp petrelharp left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks!!

@benjeffery
Copy link
Member Author

Looks great! Thanks!!
Thanks for the review!

@mergify mergify bot merged commit 881469f into tskit-dev:main Apr 29, 2021
@benjeffery benjeffery deleted the assert_equal branch May 5, 2021 13:38
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.

Add assert_equal to TableCollection and TreeSequence
2 participants