Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymedina committed Feb 28, 2024
1 parent 2fd95c9 commit bbb4182
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tests/services/synapse/test_ops.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit bbb4182

Please sign in to comment.