Esempio n. 1
0
def test_parse_fasta_fail():
    # should fail with parse error
    with pytest.raises(ValueError):
        f = StringIO(fasta_io.example)
        plain_io.read(f, protein_alphabet)

    with pytest.raises(ValueError):
        f = StringIO(plain_io.example)
        plain_io.read(f, rna_alphabet)
Esempio n. 2
0
def test_write_seq():
    f = StringIO(plain_io.example)
    seqs = plain_io.read(f)

    fout = StringIO()
    plain_io.write(fout, seqs)

    fout.seek(0)
    seqs2 = plain_io.read(fout)

    # print seqs[0].alphabet !=seqs2[0].alphabet
    assert seqs[0].alphabet == seqs2[0].alphabet
    assert seqs[0] == seqs2[0]
    assert seqs == seqs2
Esempio n. 3
0
def test_read_example():
    f = StringIO(plain_io.example)
    seqs = plain_io.read(f)
    # print seqs
    assert len(seqs) == 1
    assert seqs[0].name is None
    # print seqs[0]
    assert len(seqs[0]) == 450
Esempio n. 4
0
def test_write():
    f = StringIO(plain_io.example)
    seqs = plain_io.read(f)

    fout = StringIO()
    null_io.write(fout, seqs)
    fout.seek(0)
    assert fout.read() == ''