Skip to content

Commit 1f0c81f

Browse files
remove redundancies in tests
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 0b2e83f commit 1f0c81f

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

tests/unit/test_client.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_closing_connection_closes_commands(self):
103103

104104
# Check that the manually created mock result set's close method was called
105105
self.assertEqual(
106-
mock_result_set.has_been_closed_server_side,
106+
mock_result_set.has_been_closed_server_side,
107107
closed,
108108
)
109109
mock_result_set.close.assert_called_once_with()
@@ -169,17 +169,12 @@ def test_closing_result_set_hard_closes_commands(self):
169169
mock_results_response.command_id
170170
)
171171

172-
@patch("%s.result_set.ThriftResultSet" % PACKAGE_NAME)
173-
def test_executing_multiple_commands_uses_the_most_recent_command(
174-
self, mock_result_set_class
175-
):
172+
def test_executing_multiple_commands_uses_the_most_recent_command(self):
176173
mock_result_sets = [Mock(), Mock()]
177174
# Set is_staging_operation to False to avoid _handle_staging_operation being called
178175
for mock_rs in mock_result_sets:
179176
mock_rs.is_staging_operation = False
180177

181-
mock_result_set_class.side_effect = mock_result_sets
182-
183178
mock_backend = ThriftDatabricksClientMockFactory.new()
184179
mock_backend.execute_command.side_effect = mock_result_sets
185180

@@ -360,17 +355,13 @@ def test_execute_parameter_passthrough(self):
360355
expected_query,
361356
)
362357

363-
@patch("%s.result_set.ThriftResultSet" % PACKAGE_NAME)
364-
def test_executemany_parameter_passhthrough_and_uses_last_result_set(
365-
self, mock_result_set_class
366-
):
358+
def test_executemany_parameter_passhthrough_and_uses_last_result_set(self):
367359
# Create a new mock result set each time the class is instantiated
368360
mock_result_set_instances = [Mock(), Mock(), Mock()]
369361
# Set is_staging_operation to False to avoid _handle_staging_operation being called
370362
for mock_rs in mock_result_set_instances:
371363
mock_rs.is_staging_operation = False
372364

373-
mock_result_set_class.side_effect = mock_result_set_instances
374365
mock_backend = ThriftDatabricksClientMockFactory.new()
375366
mock_backend.execute_command.side_effect = mock_result_set_instances
376367

0 commit comments

Comments
 (0)