def test_write_leadin_with_object_without_data(self): channel = TestObject(path="", has_data=False) toc = ["kTocMetaData", "kTocRawData", "kTocNewObjList"] metadata_size = 12 segment = TdmsSegment([channel]) leadin = segment.leadin(toc, metadata_size) expected_values = [ Bytes(b'TDSm'), Int32(14), # TOC bitmask Int32(4712), # TDMS version Uint64(12), # Next segment offset Uint64(12), # Raw data offset ] self.assert_sequence_equal(leadin, expected_values)
def test_write_leadin_with_one_channel(): data_type = StubObject(size=4) channel = StubObject(path="", has_data=True, data=[0] * 10, data_type=data_type) toc = ["kTocMetaData", "kTocRawData", "kTocNewObjList"] metadata_size = 12 segment = TdmsSegment([channel]) leadin = segment.leadin(toc, metadata_size) expected_values = [ Bytes(b'TDSm'), Int32(14), # TOC bitmask Int32(4712), # TDMS version Uint64(52), # Next segment offset Uint64(12), # Raw data offset ] _assert_sequence_equal(leadin, expected_values)