From b2f377a4c0b91f8924256718633866b7eff9704a Mon Sep 17 00:00:00 2001 From: Matt Shirley Date: Sun, 14 Oct 2018 15:42:37 -0400 Subject: [PATCH] Add a test for #144 --- tests/test_feature_indexing.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_feature_indexing.py b/tests/test_feature_indexing.py index 562d89e..e55dd9e 100644 --- a/tests/test_feature_indexing.py +++ b/tests/test_feature_indexing.py @@ -322,3 +322,18 @@ def test_issue_134_no_build_index(self): """ Ensure that index file is not built when build_index=False. See mdshw5/pyfaidx#134. """ faidx = Faidx('data/genes.fasta', build_index=False) + + @raises(FastaIndexingError) + def test_issue_144_no_defline(self): + """ Ensure that an exception is raised when a file contains no deflines. See mdshw5/pyfaidx#144. + """ + tmp_dir = mkdtemp() + try: + fasta_path = os.path.join(tmp_dir, 'issue_144.fasta') + # Write simple fasta file + with open(fasta_path, 'w') as fasta_out: + fasta_out.write("CTCCGGGCCCAT\nATAAAGCCTAAA\n") + faidx = Faidx(fasta_path) + finally: + shutil.rmtree(tmp_dir) +