@@ -543,7 +543,7 @@ def test_to_format_parquet_direct(self):
543543 buffer = io .BytesIO ()
544544 # Just check that the method exists and doesn't raise errors
545545 assert hasattr (df , "write_parquet" )
546- except (IOError , ValueError , AssertionError ) as e :
546+ except (OSError , ValueError , AssertionError ) as e :
547547 pytest .fail (f"Parquet buffer creation failed: { e } " )
548548
549549 def test_to_format_feather_direct (self ):
@@ -571,7 +571,7 @@ def test_to_format_feather_direct(self):
571571 buffer = io .BytesIO ()
572572 # Just check that the method exists and doesn't raise errors
573573 assert hasattr (df , "write_ipc" )
574- except (IOError , ValueError , AssertionError ) as e :
574+ except (OSError , ValueError , AssertionError ) as e :
575575 pytest .fail (f"Feather buffer creation failed: { e } " )
576576
577577 def test_to_format_unsupported (self ):
@@ -685,7 +685,7 @@ def write_to_string_io(buffer):
685685 string_io .seek (0 )
686686 result = string_io .getvalue ()
687687 assert result == "string data"
688- except (IOError , ValueError ) as e :
688+ except (OSError , ValueError ) as e :
689689 pytest .fail (f"StringIO buffer test failed: { e } " )
690690
691691 # Test BytesIO handling (covers parquet and feather formats)
@@ -701,7 +701,7 @@ def write_to_bytes_io(buffer):
701701 bytes_io .seek (0 )
702702 result = bytes_io .read ()
703703 assert result == b"bytes data"
704- except (IOError , ValueError ) as e :
704+ except (OSError , ValueError ) as e :
705705 pytest .fail (f"BytesIO buffer test failed: { e } " )
706706
707707 def test_direct_write_to_buffer (self ):
@@ -720,7 +720,7 @@ def write_to_buffer(buffer_type, write_func, error_prefix):
720720 return "string_result"
721721 else :
722722 return buffer
723- except (IOError , ValueError , RuntimeError ) as exc :
723+ except (OSError , ValueError , RuntimeError ) as exc :
724724 raise ValueError (f"{ error_prefix } : { exc } " ) from exc
725725
726726 # Test StringIO success path
@@ -761,7 +761,7 @@ def test_buffer(buffer):
761761 return "string result"
762762 else :
763763 return buffer
764- except (IOError , ValueError , RuntimeError ) as exc :
764+ except (OSError , ValueError , RuntimeError ) as exc :
765765 raise ValueError ("Buffer operation failed" ) from exc
766766
767767 # Test successful case with StringIO
@@ -777,7 +777,7 @@ def test_buffer(buffer):
777777 def test_error ():
778778 try :
779779 raise RuntimeError ("Test error" )
780- except (RuntimeError , ValueError , IOError ) as exc :
780+ except (RuntimeError , ValueError , OSError ) as exc :
781781 raise ValueError ("Error prefix: Test error" ) from exc
782782
783783 with pytest .raises (ValueError , match = "Error prefix: Test error" ):
0 commit comments