File tree Expand file tree Collapse file tree 1 file changed +14
-15
lines changed Expand file tree Collapse file tree 1 file changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -88,21 +88,20 @@ def test_wfdb_archive_inline_round_trip():
8888 sig_len = 1000
8989 sig = (np .random .randn (sig_len , 2 ) * 1000 ).astype (np .float32 )
9090
91- # Create archive inline
92- wfdb_archive = WFDBArchive (record_basename , mode = "w" )
93- wrsamp (
94- record_name = record_basename ,
95- fs = fs ,
96- units = ["mV" , "mV" ],
97- sig_name = ["I" , "II" ],
98- p_signal = sig ,
99- fmt = ["24" , "24" ],
100- adc_gain = [200.0 , 200.0 ],
101- baseline = [0 , 0 ],
102- write_dir = tmpdir ,
103- wfdb_archive = wfdb_archive ,
104- )
105- wfdb_archive .close ()
91+ # Create archive inline using context manager
92+ with WFDBArchive (record_basename , mode = "w" ) as wfdb_archive :
93+ wrsamp (
94+ record_name = record_basename ,
95+ fs = fs ,
96+ units = ["mV" , "mV" ],
97+ sig_name = ["I" , "II" ],
98+ p_signal = sig ,
99+ fmt = ["24" , "24" ],
100+ adc_gain = [200.0 , 200.0 ],
101+ baseline = [0 , 0 ],
102+ write_dir = tmpdir ,
103+ wfdb_archive = wfdb_archive ,
104+ )
106105
107106 assert os .path .exists (archive_path ), "Archive was not created"
108107
You can’t perform that action at this time.
0 commit comments