From 9088dd198a0ac0eb81b1dedadcbce3c6149fc3d6 Mon Sep 17 00:00:00 2001 From: Matt Shirley Date: Thu, 21 Nov 2019 15:11:44 -0500 Subject: [PATCH] Add tests from #93 before merging #155 --- tests/test_feature_bounds_check.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_feature_bounds_check.py b/tests/test_feature_bounds_check.py index ab18448..e9ccdc2 100644 --- a/tests/test_feature_bounds_check.py +++ b/tests/test_feature_bounds_check.py @@ -30,6 +30,28 @@ def test_fetch_zero_length(self): fasta = Fasta('data/zero_length.fasta') b = fasta["B"] assert str(b) == '' + +class TestZeroLengthSequenceSubRange(TestCase): + def setUp(self): + pass + + def tearDown(self): + try: + os.remove('data/genes.fasta.fai') + except EnvironmentError: + pass # some tests may delete this file + + def test_as_raw_zero_length_subsequence(self): + fasta = Fasta('data/genes.fasta', as_raw=True, strict_bounds=True) + expect = '' + result = fasta['gi|557361099|gb|KF435150.1|'][100:100] + assert result == expect + + def test_zero_length_subsequence(self): + fasta = Fasta('data/genes.fasta', strict_bounds=True) + expect = '' + result = fasta['gi|557361099|gb|KF435150.1|'][100:100] + assert result.seq == expect class TestFeatureBoundsCheck: def setUp(self):