3
3
4
4
from needletail import (
5
5
NeedletailError ,
6
- PyFastxReader ,
7
6
Record ,
8
7
normalize_seq ,
9
8
parse_fastx_file ,
@@ -148,12 +147,16 @@ def test_reverse_complement(self):
148
147
self .assertEqual (reverse_complement ("atcg" ), "cgat" )
149
148
150
149
151
- class FileParsingTestCase (unittest .TestCase ):
150
+ class StrParsingTestCase (unittest .TestCase ):
152
151
def get_fasta_reader (self ):
153
- return parse_fastx_file (FASTA_FILE )
152
+ with open (FASTA_FILE ) as f :
153
+ content = f .read ()
154
+ return parse_fastx_string (content )
154
155
155
156
def get_fastq_reader (self ):
156
- return parse_fastx_file (FASTQ_FILE )
157
+ with open (FASTQ_FILE ) as f :
158
+ content = f .read ()
159
+ return parse_fastx_string (content )
157
160
158
161
def test_can_parse_fasta_file (self ):
159
162
for i , record in enumerate (self .get_fasta_reader ()):
@@ -179,23 +182,16 @@ def test_can_parse_fastq_file(self):
179
182
self .assertEqual (record .qual , ";;;;;;;;;;;7;;;;;-;;;3;83" )
180
183
self .assertTrue (i <= 2 )
181
184
182
- def test_pathlib_path_input (self ):
183
- self .assertIsInstance (parse_fastx_file (Path (FASTA_FILE )), PyFastxReader )
184
-
185
185
186
- class StrParsingTestCase ( FileParsingTestCase ):
186
+ class FileParsingTestCase ( StrParsingTestCase ):
187
187
def get_fasta_reader (self ):
188
- with open (FASTA_FILE ) as f :
189
- content = f .read ()
190
- return parse_fastx_string (content )
188
+ return parse_fastx_file (FASTA_FILE )
191
189
192
190
def get_fastq_reader (self ):
193
- with open (FASTQ_FILE ) as f :
194
- content = f .read ()
195
- return parse_fastx_string (content )
191
+ return parse_fastx_file (FASTQ_FILE )
196
192
197
193
def test_pathlib_path_input (self ):
198
- pass
194
+ parse_fastx_file ( Path ( FASTA_FILE ))
199
195
200
196
201
197
class ErroringTestCase (unittest .TestCase ):
0 commit comments