def test_get_compression_info(self): fn = '/tmp/test_get_compression_info.bag' # No Compression with rosbag.Bag(fn, mode='w') as bag: for i in xrange(100): bag.write("/test_bag", Int32(data=i)) with rosbag.Bag(fn) as bag: info = bag.get_compression_info() self.assertEquals(info.compression, rosbag.Compression.NONE) # 167 Bytes of overhead, 50 Bytes per Int32. self.assertEquals(info.uncompressed, 5167) self.assertEquals(info.compressed, 5167) with rosbag.Bag(fn, mode='w', compression=rosbag.Compression.BZ2) as bag: for i in xrange(100): bag.write("/test_bag", Int32(data=i)) with rosbag.Bag(fn) as bag: info = bag.get_compression_info() self.assertEquals(info.compression, rosbag.Compression.BZ2) self.assertEquals(info.uncompressed, 5167) # the value varies each run, I suspect based on rand, but seems # to generally be around 960 to 980 on my comp self.assertLess(info.compressed, 1000) self.assertGreater(info.compressed, 900)
def test_get_compression_info(self): fn = '/tmp/test_get_compression_info.bag' # No Compression with rosbag.Bag(fn, mode='w') as bag: for i in xrange(100): bag.write("/test_bag", Int32(data=i)) with rosbag.Bag(fn) as bag: info = bag.get_compression_info() self.assertEquals(info.compression, rosbag.Compression.NONE) # 167 Bytes of overhead, 50 Bytes per Int32. self.assertEquals(info.uncompressed, 5166) self.assertEquals(info.compressed, 5166) with rosbag.Bag(fn, mode='w', compression=rosbag.Compression.BZ2) as bag: for i in xrange(100): bag.write("/test_bag", Int32(data=i)) with rosbag.Bag(fn) as bag: info = bag.get_compression_info() self.assertEquals(info.compression, rosbag.Compression.BZ2) self.assertEquals(info.uncompressed, 5166) # the value varies each run, I suspect based on rand, but seems # to generally be around 960 to 980 on my comp self.assertLess(info.compressed, 1000) self.assertGreater(info.compressed, 900)