Skip to content

Commit d24dfd6

Browse files
committed
better test
1 parent 87114cf commit d24dfd6

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Lib/test/test_profiling/test_sampling_profiler/test_binary_format.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,15 @@ def write_sample(self, stack_frames, timestamp_us):
10331033
# keeps the samples collected before the limit was hit.
10341034
collector._writer = real_writer
10351035
collector.export(None)
1036+
1037+
with open(filename, "rb") as f:
1038+
header = f.read(32)
1039+
magic, version = struct.unpack_from("=II", header, 0)
1040+
self.assertEqual(magic, 0x54414348) # "TACH"
1041+
self.assertEqual(version, 1)
1042+
(sample_count,) = struct.unpack_from("=I", header, 28)
1043+
self.assertEqual(sample_count, 3)
1044+
10361045
reader_collector = RawCollector()
10371046
with BinaryReader(filename) as reader:
10381047
self.assertEqual(reader.replay_samples(reader_collector), 3)

0 commit comments

Comments
 (0)