def reconstruct(object): # Create a temporary buffer, which we first write the object into, and # subsequently read it from again. buffer = core.DatagramBuffer() writer = core.BamWriter(buffer) writer.init() writer.write_object(object) reader = core.BamReader(buffer) reader.init() object = reader.read_object() reader.resolve() return object
def test_collision_tube_write_old(): buffer = core.DatagramBuffer() writer = core.BamWriter(buffer) assert writer.get_file_major_ver() == 6 writer.set_file_minor_ver(43) capsule = core.CollisionCapsule((0, 0, -1), (0, 0, 1), 0.5) writer.init() writer.write_object(capsule) writer.flush() data = buffer.data assert b'CollisionTube' in data assert b'CollisionCapsule' not in data