We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dcd00c1 commit 169f2aeCopy full SHA for 169f2ae
1 file changed
python/tests/test_metadata.py
@@ -672,8 +672,22 @@ def schema_with_blobs(self, num_blobs):
672
}
673
return tskit.MetadataSchema(schema)
674
675
+ def test_round_trip_with_struct_and_json(self):
676
+ schema = dict(self.schema_with_blobs(2).schema)
677
+ schema["struct"]["properties"]["numbers"] = {
678
+ "type": "array",
679
+ "arrayLengthFormat": "H",
680
+ "items": {"type": "number", "binaryFormat": "i"},
681
+ }
682
+ ms = tskit.MetadataSchema(schema)
683
+ for v in [[], [0, 2, 12], [5] * 1000]:
684
+ row = {"label": "abcdef xyz", "count": 7, "b0": 123, "b1": 0, "numbers": v}
685
+ encoded = ms.validate_and_encode_row(row)
686
+ out = ms.decode_row(encoded)
687
+ assert out == row
688
+
689
@pytest.mark.parametrize("k", (0, 1, 5, 1001))
- def test_round_trip_with_struct_and_json(self, k):
690
+ def test_byte_alignment(self, k):
691
ms = self.schema_with_blobs(k)
692
ms0 = self.schema_with_blobs(0)
693
bytes_per_blob = len(struct.pack("i", 0))
0 commit comments