22
22
b'\x85 \xb7 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x01 ]\xff |\xe7 \x9d \x00 \x00 \x01 ]'
23
23
b'\xff |\xe7 \x9d \xff \xff \xff \xff \xff \xff \xff \xff \xff \xff \xff \xff \xff \xff '
24
24
b'\x00 \x00 \x00 \x01 \x12 \x00 \x00 \x00 \x01 \x06 123\x00 '
25
+ # Fourth batch value = "hdr" with header hkey=hval
26
+ b'\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 E\x00 \x00 \x00 \x00 \x02 \\ '
27
+ b'\xd8 \xef R\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x01 e\x85 \xb6 \xf3 \xc1 \x00 \x00 '
28
+ b'\x01 e\x85 \xb6 \xf3 \xc1 \xff \xff \xff \xff \xff \xff \xff \xff \xff \xff \xff \xff '
29
+ b'\xff \xff \x00 \x00 \x00 \x01 &\x00 \x00 \x00 \x01 \x06 hdr\x02 \x08 hkey\x08 hval'
25
30
]
26
31
27
32
record_batch_data_v1 = [
@@ -60,8 +65,8 @@ def test_memory_records_v2():
60
65
data_bytes = b"" .join (record_batch_data_v2 ) + b"\x00 " * 4
61
66
records = MemoryRecords (data_bytes )
62
67
63
- assert records .size_in_bytes () == 222
64
- assert records .valid_bytes () == 218
68
+ assert records .size_in_bytes () == 303
69
+ assert records .valid_bytes () == 299
65
70
66
71
assert records .has_next () is True
67
72
batch = records .next_batch ()
@@ -77,6 +82,12 @@ def test_memory_records_v2():
77
82
assert records .next_batch () is not None
78
83
assert records .next_batch () is not None
79
84
85
+ batch = records .next_batch ()
86
+ recs = list (batch )
87
+ assert len (recs ) == 1
88
+ assert recs [0 ].value == b"hdr"
89
+ assert recs [0 ].headers == [('hkey' , b'hval' )]
90
+
80
91
assert records .has_next () is False
81
92
assert records .next_batch () is None
82
93
assert records .next_batch () is None
0 commit comments