Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions genome_kit/diseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,10 @@ def dna(self, allow_outside_coord: bool = True) -> str:
If the segment extends past the coord intervals and
``allow_outside_coord`` is False.
"""
if type(allow_outside_coord) is not bool:
raise TypeError(
f"allow_outside_coord must be a bool, got {type(allow_outside_coord).__name__}"
)
if self._start == self._end:
return ""

Expand Down
7 changes: 7 additions & 0 deletions tests/test_diseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -2663,6 +2663,13 @@ def test_off_coord_strand_minus_coord_multi_interval(self):
)
self.assertEqual(dis.dna(), expected)

def test_passing_non_bool_raises(self):
ivs = _make_intervals([("chr1", "+", 100, 200)])
dis = DisjointIntervalSequence(ivs, on_coordinate_strand=False, start=0, end=50)
dis2 = dis.cut(10, 20)
with self.assertRaises(TypeError):
dis.dna(dis2)


if __name__ == "__main__":
unittest.main()
Loading