@@ -888,7 +888,7 @@ def test_header_with_non_utf8(self):
888888 ]
889889 assert record .units .__eq__ (sig_units_target )
890890
891- def test_wrsamp_float32_precision (self ):
891+ def test_wrsamp_float32_precision (self , temp_path ):
892892 """
893893 Test that wrsamp correctly handles float32 input without overflow.
894894
@@ -913,21 +913,19 @@ def test_wrsamp_float32_precision(self):
913913 sig_name = [f"CH{ i + 1 } " for i in range (12 )],
914914 p_signal = test_data ,
915915 fmt = ["32" ] * 12 ,
916- write_dir = self . temp_path ,
916+ write_dir = temp_path ,
917917 )
918918
919919 # Verify we can read it back without errors
920- record = wfdb .rdrecord (
921- os .path .join (self .temp_path , "float32_test" ), physical = False
922- )
920+ record = wfdb .rdrecord (os .path .join (temp_path , "float32_test" ), physical = False )
923921
924922 # Verify no digital values are out of bounds for fmt='32'
925923 dmin , dmax = - 2147483648 , 2147483647
926924 assert np .all (record .d_signal >= dmin ), "Digital values below minimum"
927925 assert np .all (record .d_signal <= dmax ), "Digital values above maximum"
928926
929927 # Verify the physical signal can be read back correctly
930- record_phys = wfdb .rdrecord (os .path .join (self . temp_path , "float32_test" ))
928+ record_phys = wfdb .rdrecord (os .path .join (temp_path , "float32_test" ))
931929
932930 # Values should be close (some precision loss is expected from ADC/DAC)
933931 np .testing .assert_allclose (
@@ -938,15 +936,6 @@ def test_wrsamp_float32_precision(self):
938936 err_msg = "Physical signal mismatch after round-trip" ,
939937 )
940938
941- @classmethod
942- def setUpClass (cls ):
943- cls .temp_directory = tempfile .TemporaryDirectory ()
944- cls .temp_path = cls .temp_directory .name
945-
946- @classmethod
947- def tearDownClass (cls ):
948- cls .temp_directory .cleanup ()
949-
950939
951940class TestMultiRecord :
952941 """Test read and write of multi segment WFDB records, including PhysioNet streaming.
0 commit comments