@@ -1094,9 +1094,11 @@ def test_from_standard_tree_sequence(self):
1094
1094
assert i1 .flags == i2 .flags
1095
1095
assert tsutil .json_metadata_is_subset (i1 .metadata , i2 .metadata )
1096
1096
# Unless inference is perfect, internal nodes may differ, but sample nodes
1097
- # should be identical
1097
+ # should be identical. Node metadata is not transferred, however, and a tsinfer-
1098
+ # specific node metadata schema is used (where empty is None rather than b"")
1099
+ assert ts .table_metadata_schemas .node == tsinfer .formats .node_metadata_schema ()
1098
1100
for n1 , n2 in zip (ts .samples (), ts_inferred .samples ()):
1099
- assert ts .node (n1 ) == ts_inferred .node (n2 )
1101
+ assert ts .node (n1 ). replace ( metadata = None ) == ts_inferred .node (n2 )
1100
1102
# Sites can have metadata added by the inference process, but inferred site
1101
1103
# metadata should always include all the metadata in the original ts
1102
1104
for s1 , s2 in zip (ts .sites (), ts_inferred .sites ()):
@@ -1586,7 +1588,7 @@ def verify(self, sample_data, mismatch_ratio=None, recombination_rate=None):
1586
1588
ancestors_time = ancestor_data .ancestors_time [:]
1587
1589
num_ancestor_nodes = 0
1588
1590
for n in ancestors_ts .nodes ():
1589
- md = json . loads ( n .metadata ) if n .metadata else {}
1591
+ md = n .metadata if n .metadata else {}
1590
1592
if tsinfer .is_pc_ancestor (n .flags ):
1591
1593
assert not ("ancestor_data_id" in md )
1592
1594
else :
@@ -3114,8 +3116,7 @@ def verify_augmented_ancestors(
3114
3116
node = t2 .nodes [m + j ]
3115
3117
assert node .flags == tsinfer .NODE_IS_SAMPLE_ANCESTOR
3116
3118
assert node .time == 1
3117
- metadata = json .loads (node .metadata .decode ())
3118
- assert node_id == metadata ["sample_data_id" ]
3119
+ assert node_id == node .metadata ["sample_data_id" ]
3119
3120
3120
3121
t2 .nodes .truncate (len (t1 .nodes ))
3121
3122
# Adding and subtracting 1 can lead to small diffs, so we compare
@@ -3265,8 +3266,7 @@ def verify_example(self, full_subset, samples, ancestors, path_compression):
3265
3266
num_sample_ancestors = 0
3266
3267
for node in final_ts .nodes ():
3267
3268
if node .flags == tsinfer .NODE_IS_SAMPLE_ANCESTOR :
3268
- metadata = json .loads (node .metadata .decode ())
3269
- assert metadata ["sample_data_id" ] in subset
3269
+ assert node .metadata ["sample_data_id" ] in subset
3270
3270
num_sample_ancestors += 1
3271
3271
assert expected_sample_ancestors == num_sample_ancestors
3272
3272
tsinfer .verify (samples , final_ts .simplify ())
0 commit comments