def test_twoheaders(self): with FastqWriter(self.path) as fq: fq.write(Sequence("name", "CCATA", "!#!#!", second_header=True)) fq.write(Sequence("name2", "HELLO", "&&&!&", second_header=True)) assert fq._file.closed with open(self.path) as t: assert t.read() == '@name\nCCATA\n+name\n!#!#!\n@name2\nHELLO\n+name2\n&&&!&\n'
def test_write_to_file_like_object(self): sio = StringIO() with FastqWriter(sio) as fq: fq.writeseq("name", "CCATA", "!#!#!") fq.writeseq("name2", "HELLO", "&&&!&&") assert sio.getvalue( ) == '@name\nCCATA\n+\n!#!#!\n@name2\nHELLO\n+\n&&&!&&\n'
def test(self): with FastqWriter(self.path) as fq: fq.writeseq("name", "CCATA", "!#!#!") fq.writeseq("name2", "HELLO", "&&&!&&") assert fq._file.closed with open(self.path) as t: assert t.read() == '@name\nCCATA\n+\n!#!#!\n@name2\nHELLO\n+\n&&&!&&\n'