@@ -3758,6 +3758,25 @@ def test_equals_options(self, ts_fixture):
3758
3758
with pytest .raises (TypeError ):
3759
3759
t1 .equals (t2 , True )
3760
3760
3761
+ # When two tables differ, check that the right reason is given
3762
+ t1 = tskit .TableCollection (sequence_length = 1.0 )
3763
+ t2 = tskit .TableCollection (sequence_length = 1.0 )
3764
+ t1 .assert_equals (t2 )
3765
+ t1 .metadata = b""
3766
+ t2 .metadata = b"abc"
3767
+ t1 .assert_equals (t2 , ignore_ts_metadata = True )
3768
+ t1 .edges .add_row (0 , 1 , 0 , 1 )
3769
+ with pytest .raises (AssertionError , match = "EdgeTable number of rows" ):
3770
+ t1 .assert_equals (t2 , ignore_ts_metadata = True )
3771
+ t2 .metadata = b""
3772
+ t2 .edges .add_row (0 , 1 , 0 , 1 , metadata = b"abc" )
3773
+ t1 .assert_equals (t2 , ignore_metadata = True )
3774
+ t1 .edges .add_row (0 , 1 , 0 , 1 )
3775
+ with pytest .raises (AssertionError , match = "EdgeTable number of rows" ):
3776
+ t1 .assert_equals (t2 , ignore_metadata = True )
3777
+ with pytest .raises (AssertionError , match = "EdgeTable row 0 differs" ):
3778
+ t1 .assert_equals (t2 )
3779
+
3761
3780
def test_sequence_length (self ):
3762
3781
for sequence_length in [0 , 1 , 100.1234 ]:
3763
3782
tables = tskit .TableCollection (sequence_length = sequence_length )
0 commit comments