From aad7b14d09998d8581ab0f5ee3aec0f3d2e3816d Mon Sep 17 00:00:00 2001 From: Benjamin Moody Date: Wed, 29 Sep 2021 12:35:26 -0400 Subject: [PATCH] Add test cases for reading/writing huge skips. 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. --- sample-data/huge.qrs | Bin 0 -> 34 bytes tests/test_annotation.py | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 sample-data/huge.qrs diff --git a/sample-data/huge.qrs b/sample-data/huge.qrs new file mode 100644 index 0000000000000000000000000000000000000000..f48e8e03e317aeaf3b4ed21a7bb96f5d3c9ab2a3 GIT binary patch literal 34 YcmZR0^S}Q8e+DchcL>W91{MYe0FvPo*Z=?k literal 0 HcmV?d00001 diff --git a/tests/test_annotation.py b/tests/test_annotation.py index 4fc33cc3..c7d0f4d3 100644 --- a/tests/test_annotation.py +++ b/tests/test_annotation.py @@ -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):