File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,21 @@ def test_cursor_attribute():
6262 assert cursor .lastrowid is None
6363
6464
65+ def test_query_can_be_empty_with_dataframe_ast ():
66+ def mock_is_closed (* args , ** kwargs ):
67+ return False
68+
69+ fake_conn = FakeConnection ()
70+ fake_conn .is_closed = mock_is_closed
71+ cursor = SnowflakeCursor (fake_conn )
72+ # when `dataframe_ast` is not presented, the execute function return None
73+ assert cursor .execute ("" ) is None
74+ # when `dataframe_ast` is presented, it should not return `None`
75+ # but raise `AttributeError` since `_paramstyle` is not set in FakeConnection.
76+ with pytest .raises (AttributeError ):
77+ cursor .execute ("" , _dataframe_ast = "ABCD" )
78+
79+
6580@patch ("snowflake.connector.cursor.SnowflakeCursor._SnowflakeCursor__cancel_query" )
6681def test_cursor_execute_timeout (mockCancelQuery ):
6782 def mock_cmd_query (* args , ** kwargs ):
You can’t perform that action at this time.
0 commit comments