def test_read_aid_no_regex_with_prefix(self): t1 = AtomsCollection("t1", "./tests/store") fn1 = "../homer/ni.p454.out" prefix = "Test" a5 = t1._read_aid(fn1, None, prefix) assert a5 == "test_ni.p454.out" shutil.rmtree("./tests/store")
def test_read_aid(self): t1 = AtomsCollection("t1", "./tests/store") rxid = r'ni.p(?P<gbid>\d+).out' import re c_rxid = re.compile(rxid) fn1 = "../homer/ni.p454.out" a1 = t1._read_aid(fn1, c_rxid) assert a1 == "454" shutil.rmtree("./tests/store")
def test_read_aid_with_prefix(self): t1 = AtomsCollection("t1", "./tests/store") rxid = r'ni.p(?P<gbid>\d+).out' import re c_rxid = re.compile(rxid) fn1 = "../homer/ni.p454.out" prefix = "Pre" a2 = t1._read_aid(fn1, c_rxid, prefix) assert a2 == "pre_454" shutil.rmtree("./tests/store")
def test_read_aid_invalid_regex(self): t1 = AtomsCollection("t1", "./tests/store") fn1 = "../homer/ni.p454.out" prefix = "Test" output2 = io.StringIO() sys.stdout = output2 import re c_rxid3 = re.compile(r'ni.p(P<gbid>\d+).out') a6 = t1._read_aid(fn1, c_rxid3, prefix) assert "Regex found no pattern. Resolving to filename as aid.\n" == output2.getvalue( ) assert a6 == "test_ni.p454.out" shutil.rmtree("./tests/store")
def test_read_aid_no_regex(self): t1 = AtomsCollection("t1", "./tests/store") fn1 = "../homer/ni.p454.out" a4 = t1._read_aid(fn1, None) assert a4 == "ni.p454.out" shutil.rmtree("./tests/store")