Skip to content

Commit ed7d058

Browse files
committed
fix: Classyfire Test coverage
1 parent ae7e26a commit ed7d058

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

tests/test_classyfire.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ async def test_classify_http_error(mock_async_client, valid_smiles):
9898
# Create mock client instance and context manager
9999
mock_client_instance = MagicMock()
100100
mock_async_client.return_value.__aenter__.return_value = mock_client_instance
101-
101+
102102
# Mock the POST to raise an HTTPError
103103
mock_client_instance.post = AsyncMock(
104104
side_effect=httpx.HTTPError("Connection failed")
105105
)
106-
106+
107107
# Should re-raise the HTTPError
108108
with pytest.raises(httpx.HTTPError):
109109
await classify(valid_smiles)
@@ -116,12 +116,12 @@ async def test_classify_timeout_error(mock_async_client, valid_smiles):
116116
# Create mock client instance and context manager
117117
mock_client_instance = MagicMock()
118118
mock_async_client.return_value.__aenter__.return_value = mock_client_instance
119-
119+
120120
# Mock the POST to raise a timeout error
121121
mock_client_instance.post = AsyncMock(
122122
side_effect=httpx.TimeoutException("Request timed out")
123123
)
124-
124+
125125
# Should re-raise the HTTPError (TimeoutException is a subclass of HTTPError)
126126
with pytest.raises(httpx.HTTPError):
127127
await classify(valid_smiles)
@@ -134,12 +134,12 @@ async def test_result_http_error(mock_async_client):
134134
# Create mock client instance and context manager
135135
mock_client_instance = MagicMock()
136136
mock_async_client.return_value.__aenter__.return_value = mock_client_instance
137-
137+
138138
# Mock the GET to raise an HTTPError
139139
mock_client_instance.get = AsyncMock(
140140
side_effect=httpx.HTTPError("Connection failed")
141141
)
142-
142+
143143
# Should re-raise the HTTPError
144144
with pytest.raises(httpx.HTTPError):
145145
await result("12345")
@@ -152,21 +152,18 @@ async def test_result_not_found_error(mock_async_client):
152152
# Create mock client instance and context manager
153153
mock_client_instance = MagicMock()
154154
mock_async_client.return_value.__aenter__.return_value = mock_client_instance
155-
155+
156156
# Create a mock response for 404
157157
mock_response = MagicMock()
158158
mock_response.status_code = 404
159-
159+
160160
# Mock the GET to raise an HTTPStatusError
161161
mock_client_instance.get = AsyncMock(
162162
side_effect=httpx.HTTPStatusError(
163-
"Not Found",
164-
request=MagicMock(),
165-
response=mock_response
163+
"Not Found", request=MagicMock(), response=mock_response
166164
)
167165
)
168-
166+
169167
# Should re-raise the HTTPError
170168
with pytest.raises(httpx.HTTPError):
171169
await result("invalid_id")
172-

0 commit comments

Comments
 (0)