From bbb41826620bd6e4144b542928f88de7a51955e5 Mon Sep 17 00:00:00 2001 From: Jenny Medina Date: Tue, 27 Feb 2024 19:06:17 -0500 Subject: [PATCH] style --- tests/services/synapse/test_ops.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/services/synapse/test_ops.py b/tests/services/synapse/test_ops.py index 8341bde..db368de 100644 --- a/tests/services/synapse/test_ops.py +++ b/tests/services/synapse/test_ops.py @@ -1,8 +1,8 @@ +from unittest.mock import MagicMock + +import pandas as pd import pytest import synapseclient -import pandas as pd -from unittest.mock import MagicMock, patch -from unittest import mock from orca.errors import ConfigError from orca.services.synapse import SynapseOps @@ -48,7 +48,7 @@ def test_trigger_indexing(mocker, mocked_ops): submission_view = "test_view" # Using patch to mock the Synapse tableQuery method - with mocker.patch.object(syn_mock, "tableQuery") as table_query_mock: + with mocker.patch.object(syn_mock, "tableQuery"): # Calling the function mocked_ops.trigger_indexing(syn_mock, submission_view) @@ -83,12 +83,10 @@ def test_get_submissions(mocker, mocked_ops): table_mock.asDataFrame.return_value = pd.DataFrame( input_dict ) # input_dict#pd.DataFrame({"id": submission_ids}) - # table_mock.asCsvFileTable.return_value = createMockTable(mock, pd.DataFrame(input_dict)) - # Mock the ``trigger_indexing`` call in SynapseOps() and the tableQuery call in ``SynapseOps().get_submissions`` - with mocker.patch.object( - mocked_ops, "trigger_indexing", return_value=None - ) as trigger_indexing_mock: + # Mock the ``trigger_indexing`` call in SynapseOps() and the tableQuery call + # in ``SynapseOps().get_submissions`` + with mocker.patch.object(mocked_ops, "trigger_indexing", return_value=None): with mocker.patch.object(syn_mock, "tableQuery", return_value=table_mock): # Calling the function to be tested result = mocked_ops.get_submissions(submission_view, submission_status) @@ -120,7 +118,7 @@ def test_update_submission_status_with_non_string_non_list_input(mocker, mocked_ # Test for non-string + non-list submission_ids. with mocker.patch.object( mocked_ops, "update_submissions_status", side_effect=TypeError - ) as moc: + ): with pytest.raises(TypeError): # Calling the function to be tested mocked_ops.update_submissions_status(1234, "SCORED") @@ -134,7 +132,7 @@ def test_update_submission_status_with_non_string_in_list(mocker, mocked_ops): # Test for non-string elements in list with mocker.patch.object( mocked_ops, "update_submissions_status", side_effect=TypeError - ) as moc: + ): with pytest.raises(TypeError): # Calling the function to be tested mocked_ops.update_submissions_status(["syn111", 1234], "SCORED")