Skip to content

Add assert_equal to TableCollection and TreeSequence #1076

@jeromekelleher

Description

@jeromekelleher

The '.equalsmethod is very useful, but it doesn't tell us where the problem is when tables are not equal. We should add methodsassert_equal`` which would initially look like

def assert_equal(self, other, ignore_provenance=...) # same signature as equals
    assert self.sequence_length == other.sequence_length
    assert self.nodes == other.nodes
    # etc

This would at least tell us which table the mismatch occurs in. We can imagine providing a more detailed picture of how tables differ at some point, but this could be added later as a refinement. This form assert_equal should integrate nicely with pytest, and clean up our testing code some more.

Seems like a straightforward win?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Python APIIssue is about the Python API

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions