<commit_before>#!/usr/bin/env python
from subprocess import Popen, PIPE, check_call
from os import remove

# N.B., this MUST be run from within the source directory!

# local test
p1 = Popen(["./test/testLocal", "test/test.bw"], stdout=PIPE)
try:
    p2 = Popen(["md5sum"], stdin=p1.stdout, stdout=PIPE)
except:
    p2 = Popen(["md5"], stdin=p1.stdout, stdout=PIPE)
md5sum = p2.communicate()[0].strip().split()[0]
assert(md5sum == "a15cbf0021f3e80d9ddfd9dbe78057cf")

# remote http test
p1 = Popen(["./test/testRemote", "http://hgdownload.cse.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeMapability/wgEncodeCrgMapabilityAlign50mer.bigWig"], stdout=PIPE)
try:
    p2 = Popen(["md5sum"], stdin=p1.stdout, stdout=PIPE)
except:
    p2 = Popen(["md5"], stdin=p1.stdout, stdout=PIPE)
md5sum = p2.communicate()[0].strip().split()[0]
assert(md5sum == "9ccecd6c32ff31042714c1da3c0d0eba")

# test recreating a file
p1 = check_call(["./test/testWrite", "test/test.bw", "test/output.bw"])
assert(p1 == 0)
try:
    p2 = Popen(["md5sum"], stdin=p1.stdout, stdout=PIPE)
except:
    p2 = Popen(["md5"], stdin=p1.stdout, stdout=PIPE)
md5sum = p2.communicate()[0].strip().split()[0]
assert(md5sum == "8e116bd114ffd2eb625011d451329c03")
remove("test/output.bw")

# test creation from scratch with multiple interval types
p1 = check_call(["./test/exampleWrite"])
assert(p1 == 0)
try:
    p2 = Popen(["md5sum"], stdin=p1.stdout, stdout=PIPE)
except:
    p2 = Popen(["md5"], stdin=p1.stdout, stdout=PIPE)
md5sum = p2.communicate()[0].strip().split()[0]
assert(md5sum == "ef104f198c6ce8310acc149d0377fc16")
remove("test/example_output.bw")<commit_msg>Fix test/test.py<commit_after>#!/usr/bin/env python
from subprocess import Popen, PIPE, check_call
from os import remove

# N.B., this MUST be run from within the source directory!

# local test
p1 = Popen(["./test/testLocal", "test/test.bw"], stdout=PIPE)
try:
    p2 = Popen(["md5sum"], stdin=p1.stdout, stdout=PIPE)
except:
    p2 = Popen(["md5"], stdin=p1.stdout, stdout=PIPE)
md5sum = p2.communicate()[0].strip().split()[0]
assert(md5sum == "a15cbf0021f3e80d9ddfd9dbe78057cf")

# remote http test
p1 = Popen(["./test/testRemote", "http://hgdownload.cse.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeMapability/wgEncodeCrgMapabilityAlign50mer.bigWig"], stdout=PIPE)
try:
    p2 = Popen(["md5sum"], stdin=p1.stdout, stdout=PIPE)
except:
    p2 = Popen(["md5"], stdin=p1.stdout, stdout=PIPE)
md5sum = p2.communicate()[0].strip().split()[0]
assert(md5sum == "9ccecd6c32ff31042714c1da3c0d0eba")

# test recreating a file
p1 = check_call(["./test/testWrite", "test/test.bw", "test/output.bw"])
assert(p1 == 0)
try:
    p2 = Popen(["md5sum", "test/output.bw"], stdout=PIPE)
except:
    p2 = Popen(["md5", "test/output.bw"], stdout=PIPE)
md5sum = p2.communicate()[0].strip().split()[0]
assert(md5sum == "8e116bd114ffd2eb625011d451329c03")
remove("test/output.bw")

# test creation from scratch with multiple interval types
p1 = check_call(["./test/exampleWrite"])
assert(p1 == 0)
try:
    p2 = Popen(["md5sum", "test/example_output.bw"], stdout=PIPE)
except:
    p2 = Popen(["md5", "test/example_output.bw"], stdout=PIPE)
md5sum = p2.communicate()[0].strip().split()[0]
assert(md5sum == "ef104f198c6ce8310acc149d0377fc16")
remove("test/example_output.bw")
{'fraction_non_alphanumeric': 0.18442748091603053, 'fraction_numerical': 0.07816793893129771, 'mean_word_length': 5.825, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3893533', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1355, 'n_words': 230}