Skip to content

Commit 0010f64

Browse files
apcamargoaudy
authored andcommitted
Make FileParsingTestCase inherit from StrParsingTestCase
1 parent cdbb275 commit 0010f64

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

test_python.py

+11-15
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from needletail import (
55
NeedletailError,
6-
PyFastxReader,
76
Record,
87
normalize_seq,
98
parse_fastx_file,
@@ -148,12 +147,16 @@ def test_reverse_complement(self):
148147
self.assertEqual(reverse_complement("atcg"), "cgat")
149148

150149

151-
class FileParsingTestCase(unittest.TestCase):
150+
class StrParsingTestCase(unittest.TestCase):
152151
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)
154155

155156
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)
157160

158161
def test_can_parse_fasta_file(self):
159162
for i, record in enumerate(self.get_fasta_reader()):
@@ -179,23 +182,16 @@ def test_can_parse_fastq_file(self):
179182
self.assertEqual(record.qual, ";;;;;;;;;;;7;;;;;-;;;3;83")
180183
self.assertTrue(i <= 2)
181184

182-
def test_pathlib_path_input(self):
183-
self.assertIsInstance(parse_fastx_file(Path(FASTA_FILE)), PyFastxReader)
184-
185185

186-
class StrParsingTestCase(FileParsingTestCase):
186+
class FileParsingTestCase(StrParsingTestCase):
187187
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)
191189

192190
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)
196192

197193
def test_pathlib_path_input(self):
198-
pass
194+
parse_fastx_file(Path(FASTA_FILE))
199195

200196

201197
class ErroringTestCase(unittest.TestCase):

0 commit comments

Comments
 (0)