Skip to content

Commit

Permalink
Add test cases for reading/writing huge skips.
Browse files Browse the repository at this point in the history
Check that we can both read and write an annotation file containing a
relative offset of more than 2**31 - 1 ticks, which necessitates the
use of multiple SKIP pseudo-annotations.
  • Loading branch information
Benjamin Moody committed Sep 30, 2021
1 parent 0dab235 commit aad7b14
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Binary file added sample-data/huge.qrs
Binary file not shown.
16 changes: 16 additions & 0 deletions tests/test_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,28 @@ def test_3(self):
assert annotation.__eq__(pn_annotation)
assert annotation.__eq__(write_annotation)

def test_4(self):
"""
Read and write annotations with large time skips
Annotation file created by:
echo "xxxxxxxxx 10000000000 N 0 0 0" | wrann -r huge -a qrs
"""
annotation = wfdb.rdann('sample-data/huge', 'qrs')
self.assertEqual(annotation.sample[0], 10000000000)
annotation.wrann()

annotation1 = wfdb.rdann('sample-data/huge', 'qrs')
annotation2 = wfdb.rdann('huge', 'qrs')
self.assertEqual(annotation1, annotation2)

@classmethod
def tearDownClass(cls):
writefiles = [
'100.atr',
'1003.atr',
'12726.anI',
'huge.qrs',
]
for file in writefiles:
if os.path.isfile(file):
Expand Down

0 comments on commit aad7b14

Please # to comment.