def test_only_split_maps_filter_paired_stream(): infile = testfiles['split_filter_test_paired.map'] filtered = filter.only_split_maps(infile) assert filtered is not None all_maps = 0 for template in filtered: all_maps += template.get_num_maps() assert all_maps == 1
def test_only_split_maps_filter_paired_compress_file(): target = results_dir + "/filtered.map.gz" target_uncompressed = results_dir + "/filtered.map" infile = testfiles['split_filter_test_paired.map'] filtered = filter.only_split_maps(infile, output=target, compress=True) assert filtered is not None all_maps = 0 for template in filtered: all_maps += template.get_num_maps() # check the files assert os.path.exists(target) # lets unzip the file to test gzip import subprocess assert subprocess.Popen(['gunzip', '-f', target]).wait() == 0 assert os.path.exists(target_uncompressed) with open(target_uncompressed) as f: lines = f.readlines() print lines assert len(lines) == 3