Skip to content

Commit 43dbc7f

Browse files
committed
Close test annotation files
1 parent 6a0de80 commit 43dbc7f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/test_annotation.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def test_1(self):
3333
# no null to detect in the output text file of rdann.
3434

3535
# Target data from WFDB software package
36-
lines = tuple(open("tests/target-output/ann-1", "r"))
36+
with open("tests/target-output/ann-1", "r") as f:
37+
lines = tuple(f)
3738
nannot = len(lines)
3839

3940
target_time = [None] * nannot
@@ -108,7 +109,8 @@ def test_2(self):
108109
annotation = wfdb.rdann("sample-data/12726", "anI")
109110

110111
# Target data from WFDB software package
111-
lines = tuple(open("tests/target-output/ann-2", "r"))
112+
with open("tests/target-output/ann-2", "r") as f:
113+
lines = tuple(f)
112114
nannot = len(lines)
113115

114116
target_time = [None] * nannot
@@ -181,7 +183,8 @@ def test_3(self):
181183
annotation = wfdb.rdann("sample-data/1003", "atr")
182184

183185
# Target data from WFDB software package
184-
lines = tuple(open("tests/target-output/ann-3", "r"))
186+
with open("tests/target-output/ann-3", "r") as f:
187+
lines = tuple(f)
185188
nannot = len(lines)
186189

187190
target_time = [None] * nannot

0 commit comments

Comments
 (0)