Skip to content

Commit 86ee56f

Browse files
test unimplemented methods and max_download_threads prop
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 390c1e7 commit 86ee56f

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

tests/unit/test_sea_backend.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,81 @@ def test_session_configuration_helpers(self):
203203
"USE_CACHED_RESULT",
204204
}
205205
assert set(allowed_configs) == expected_keys
206+
207+
def test_unimplemented_methods(self, sea_client):
208+
"""Test that unimplemented methods raise NotImplementedError."""
209+
# Create dummy parameters for testing
210+
session_id = SessionId.from_sea_session_id("test-session")
211+
command_id = MagicMock()
212+
cursor = MagicMock()
213+
214+
# Test execute_command
215+
with pytest.raises(NotImplementedError) as excinfo:
216+
sea_client.execute_command(
217+
operation="SELECT 1",
218+
session_id=session_id,
219+
max_rows=100,
220+
max_bytes=1000,
221+
lz4_compression=False,
222+
cursor=cursor,
223+
use_cloud_fetch=False,
224+
parameters=[],
225+
async_op=False,
226+
enforce_embedded_schema_correctness=False,
227+
)
228+
assert "execute_command is not yet implemented" in str(excinfo.value)
229+
230+
# Test cancel_command
231+
with pytest.raises(NotImplementedError) as excinfo:
232+
sea_client.cancel_command(command_id)
233+
assert "cancel_command is not yet implemented" in str(excinfo.value)
234+
235+
# Test close_command
236+
with pytest.raises(NotImplementedError) as excinfo:
237+
sea_client.close_command(command_id)
238+
assert "close_command is not yet implemented" in str(excinfo.value)
239+
240+
# Test get_query_state
241+
with pytest.raises(NotImplementedError) as excinfo:
242+
sea_client.get_query_state(command_id)
243+
assert "get_query_state is not yet implemented" in str(excinfo.value)
244+
245+
# Test get_execution_result
246+
with pytest.raises(NotImplementedError) as excinfo:
247+
sea_client.get_execution_result(command_id, cursor)
248+
assert "get_execution_result is not yet implemented" in str(excinfo.value)
249+
250+
# Test metadata operations
251+
with pytest.raises(NotImplementedError) as excinfo:
252+
sea_client.get_catalogs(session_id, 100, 1000, cursor)
253+
assert "get_catalogs is not yet implemented" in str(excinfo.value)
254+
255+
with pytest.raises(NotImplementedError) as excinfo:
256+
sea_client.get_schemas(session_id, 100, 1000, cursor)
257+
assert "get_schemas is not yet implemented" in str(excinfo.value)
258+
259+
with pytest.raises(NotImplementedError) as excinfo:
260+
sea_client.get_tables(session_id, 100, 1000, cursor)
261+
assert "get_tables is not yet implemented" in str(excinfo.value)
262+
263+
with pytest.raises(NotImplementedError) as excinfo:
264+
sea_client.get_columns(session_id, 100, 1000, cursor)
265+
assert "get_columns is not yet implemented" in str(excinfo.value)
266+
267+
def test_max_download_threads_property(self, sea_client):
268+
"""Test the max_download_threads property."""
269+
assert sea_client.max_download_threads == 10
270+
271+
# Create a client with a custom value
272+
custom_client = SeaDatabricksClient(
273+
server_hostname="test-server.databricks.com",
274+
port=443,
275+
http_path="/sql/warehouses/abc123",
276+
http_headers=[],
277+
auth_provider=AuthProvider(),
278+
ssl_options=SSLOptions(),
279+
max_download_threads=20,
280+
)
281+
282+
# Verify the custom value is returned
283+
assert custom_client.max_download_threads == 20

0 commit comments

Comments
 (0)