1818from databricks .sql .exc import (
1919 Error ,
2020 NotSupportedError ,
21+ ProgrammingError ,
2122 ServerOperationError ,
2223 DatabaseError ,
2324)
@@ -129,7 +130,7 @@ def test_initialization(self, mock_http_client):
129130 assert client3 .max_download_threads == 5
130131
131132 # Test with invalid HTTP path
132- with pytest .raises (ValueError ) as excinfo :
133+ with pytest .raises (ProgrammingError ) as excinfo :
133134 SeaDatabricksClient (
134135 server_hostname = "test-server.databricks.com" ,
135136 port = 443 ,
@@ -195,7 +196,7 @@ def test_session_management(self, sea_client, mock_http_client, thrift_session_i
195196 )
196197
197198 # Test close_session with invalid ID type
198- with pytest .raises (ValueError ) as excinfo :
199+ with pytest .raises (ProgrammingError ) as excinfo :
199200 sea_client .close_session (thrift_session_id )
200201 assert "Not a valid SEA session ID" in str (excinfo .value )
201202
@@ -244,7 +245,7 @@ def test_command_execution_sync(
244245 assert cmd_id_arg .guid == "test-statement-123"
245246
246247 # Test with invalid session ID
247- with pytest .raises (ValueError ) as excinfo :
248+ with pytest .raises (ProgrammingError ) as excinfo :
248249 mock_thrift_handle = MagicMock ()
249250 mock_thrift_handle .sessionId .guid = b"guid"
250251 mock_thrift_handle .sessionId .secret = b"secret"
@@ -452,7 +453,7 @@ def test_command_management(
452453 )
453454
454455 # Test cancel_command with invalid ID
455- with pytest .raises (ValueError ) as excinfo :
456+ with pytest .raises (ProgrammingError ) as excinfo :
456457 sea_client .cancel_command (thrift_command_id )
457458 assert "Not a valid SEA command ID" in str (excinfo .value )
458459
@@ -466,7 +467,7 @@ def test_command_management(
466467 )
467468
468469 # Test close_command with invalid ID
469- with pytest .raises (ValueError ) as excinfo :
470+ with pytest .raises (ProgrammingError ) as excinfo :
470471 sea_client .close_command (thrift_command_id )
471472 assert "Not a valid SEA command ID" in str (excinfo .value )
472473
@@ -525,7 +526,7 @@ def test_command_management(
525526 assert result .status == CommandState .SUCCEEDED
526527
527528 # Test get_execution_result with invalid ID
528- with pytest .raises (ValueError ) as excinfo :
529+ with pytest .raises (ProgrammingError ) as excinfo :
529530 sea_client .get_execution_result (thrift_command_id , mock_cursor )
530531 assert "Not a valid SEA command ID" in str (excinfo .value )
531532
@@ -721,7 +722,7 @@ def test_get_schemas(self, sea_client, sea_session_id, mock_cursor):
721722 )
722723
723724 # Case 3: Without catalog name (should raise ValueError)
724- with pytest .raises (ValueError ) as excinfo :
725+ with pytest .raises (DatabaseError ) as excinfo :
725726 sea_client .get_schemas (
726727 session_id = sea_session_id ,
727728 max_rows = 100 ,
@@ -872,7 +873,7 @@ def test_get_columns(self, sea_client, sea_session_id, mock_cursor):
872873 )
873874
874875 # Case 3: Without catalog name (should raise ValueError)
875- with pytest .raises (ValueError ) as excinfo :
876+ with pytest .raises (DatabaseError ) as excinfo :
876877 sea_client .get_columns (
877878 session_id = sea_session_id ,
878879 max_rows = 100 ,
0 commit comments