def test_find_decompressor(): log_file = "testfile" eq_(find_decompressor(log_file), "cat") log_file = "log.bz2" eq_(find_decompressor(log_file), "bzip2 -dc") log_file = "log.gz" eq_(find_decompressor(log_file), "gzip -dc") log_file = "log.tar.xz" eq_(find_decompressor(log_file), "xz -dc") log_file = create_tempfile() with open(log_file, 'w') as f: f.write("test") eq_(find_decompressor(log_file), "cat") os.remove(log_file)
def test_find_decompressor(): log_file = "testfile" assert find_decompressor(log_file) == "cat" log_file = "log.bz2" assert find_decompressor(log_file) == "bzip2 -dc" log_file = "log.gz" assert find_decompressor(log_file) == "gzip -dc" log_file = "log.tar.xz" assert find_decompressor(log_file) == "xz -dc" log_file = create_tempfile() with open(log_file, 'w') as f: f.write("test") assert find_decompressor(log_file) == "cat" os.remove(log_file)