Пример #1
0
def test_output_sans_desc():
    read = FakeRecord()
    read.name = 'foo'
    read.sequence = 'ATCG'

    fileobj = BytesIO()
    write_fastx(read, fileobj)
    assert fileobj.getvalue().decode('utf-8') == '>foo\nATCG\n'
Пример #2
0
def test_output_sans_desc():
    read = FakeRecord()
    read.name = 'foo'
    read.sequence = 'ATCG'

    fileobj = BytesIO()
    write_fastx(read, fileobj)
    assert fileobj.getvalue().decode('utf-8') == '>foo\nATCG\n'
Пример #3
0
def test_output_two_reads():
    fileobj = BytesIO()
    for i in range(2):
        read = FakeRecord()
        read.name = 'seq{}'.format(i)
        read.sequence = 'GATTACA' * (i + 1)
        write_fastx(read, fileobj)
    testoutput = '>seq0\nGATTACA\n>seq1\nGATTACAGATTACA\n'
    assert fileobj.getvalue().decode('utf-8') == testoutput
Пример #4
0
def test_output_two_reads():
    fileobj = BytesIO()
    for i in range(2):
        read = FakeRecord()
        read.name = 'seq{}'.format(i)
        read.sequence = 'GATTACA' * (i + 1)
        write_fastx(read, fileobj)
    testoutput = '>seq0\nGATTACA\n>seq1\nGATTACAGATTACA\n'
    assert fileobj.getvalue().decode('utf-8') == testoutput
Пример #5
0
def test_output_with_desc():
    read = FakeRecord()
    read.name = 'foo'
    read.description = 'bar'
    read.sequence = 'ATCG'
    read.quality = '####'

    fileobj = BytesIO()
    write_fastx(read, fileobj)
    assert fileobj.getvalue().decode('utf-8') == '@foo bar\nATCG\n+\n####\n'
Пример #6
0
def test_output_with_desc():
    read = FakeRecord()
    read.name = 'foo'
    read.description = 'bar'
    read.sequence = 'ATCG'
    read.quality = '####'

    fileobj = BytesIO()
    write_fastx(read, fileobj)
    assert fileobj.getvalue().decode('utf-8') == '@foo bar\nATCG\n+\n####\n'
Пример #7
0
def test_output_bad_mode():
    read = FakeRecord()
    read.name = 'foo'
    read.description = 'bar'
    read.sequence = 'ATCG'
    read.quality = '####'

    fileobj = StringIO()
    with pytest.raises(AttributeError) as ae:
        write_fastx(read, fileobj)
    assert 'cannot call "write_fastx" on object' in str(ae)
Пример #8
0
def test_output_bad_mode():
    read = FakeRecord()
    read.name = 'foo'
    read.description = 'bar'
    read.sequence = 'ATCG'
    read.quality = '####'

    fileobj = StringIO()
    with pytest.raises(AttributeError) as ae:
        write_fastx(read, fileobj)
    assert 'cannot call "write_fastx" on object' in str(ae)