def test19(): """Test with differnt column width""" colwidth = random.randint(60, 100) L = [ dnaSeq_sol.dnaSeq(randomSeq(random.randint(300, 600))) for i in range(5) ] for d in L: d.info = ">" + "".join([random.choice("ABCDEFH ") for i in range(30)]) dnaSeq_sol.writeFA(L, "test1.fa", col_width=colwidth) L2 = [] for l in L: d = dnaSeq.dnaSeq(str(l)) d.info = l.info L2.append(d) dnaSeq.writeFA(L2, "test2.fa", col_width=colwidth) ## compare files for l1, l2 in zip(open("test1.fa"), open("test2.fa")): if l1[0] == '>': if l1.lstrip('>').strip() != l2.lstrip('>').strip(): return False else: if l1 != l2: return False return True
def test19(): """Test with differnt column width""" colwidth = random.randint(60,100) L = [dnaSeq_sol.dnaSeq(randomSeq(random.randint(300,600))) for i in range(5)] for d in L: d.info = ">" + "".join([random.choice("ABCDEFH ") for i in range(30)]) dnaSeq_sol.writeFA(L, "test1.fa", col_width = colwidth) L2 = [] for l in L: d = dnaSeq.dnaSeq(str(l)) d.info = l.info L2.append(d) dnaSeq.writeFA(L2, "test2.fa", col_width = colwidth) ## compare files for l1,l2 in zip(open("test1.fa"), open("test2.fa")): if l1[0] == '>': if l1.lstrip('>').strip() != l2.lstrip('>').strip(): return False else: if l1 != l2: return False return True
def test17(): L = [dnaSeq_sol.dnaSeq(randomSeq(random.randint(300,600))) for i in range(5)] for d in L: d.info = ">" + "".join([random.choice("ABCDEFH ") for i in range(30)]) dnaSeq_sol.writeFA(L, "test.fa") L2 = dnaSeq.readFA("test.fa") return all([o1.info.lstrip('>').strip()==o2.info.lstrip('>').strip() and str(o1)==str(o2) for o1,o2 in zip(L,L2)])
def test17(): L = [ dnaSeq_sol.dnaSeq(randomSeq(random.randint(300, 600))) for i in range(5) ] for d in L: d.info = ">" + "".join([random.choice("ABCDEFH ") for i in range(30)]) dnaSeq_sol.writeFA(L, "test.fa") L2 = dnaSeq.readFA("test.fa") return all([ o1.info.lstrip('>').strip() == o2.info.lstrip('>').strip() and str(o1) == str(o2) for o1, o2 in zip(L, L2) ])