Skip to content

Commit de0e4d7

Browse files
committed
Changed assertion to assert called once
1 parent 7c9fd86 commit de0e4d7

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

tests/test_asyncio/test_connection.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,7 @@ async def test_client_do_not_retry_write_on_read_failure(mock_connection, mock_p
336336
await r.set("key", "value")
337337

338338
# If read from socket fails, writes won't be executed.
339-
mock_connection.send_command.assert_has_calls(
340-
[
341-
call("SET", "key", "value"),
342-
]
343-
)
339+
mock_connection.send_command.assert_called_once_with("SET", "key", "value")
344340

345341

346342
@pytest.mark.onlynoncluster
@@ -367,11 +363,7 @@ async def test_pipeline_immediate_do_not_retry_write_on_read_failure(
367363
await pipe.immediate_execute_command("SET", "key", "value")
368364

369365
# If read from socket fails, writes won't be executed.
370-
mock_connection.send_command.assert_has_calls(
371-
[
372-
call("SET", "key", "value"),
373-
]
374-
)
366+
mock_connection.send_command.assert_called_once_with("SET", "key", "value")
375367

376368

377369
async def test_close_is_aclose(request):

tests/test_connection.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,7 @@ def test_client_do_not_retry_write_on_read_failure(mock_connection, mock_pool):
267267
r.set("key", "value")
268268

269269
# If read from socket fails, writes won't be executed.
270-
mock_connection.send_command.assert_has_calls(
271-
[
272-
call("SET", "key", "value"),
273-
]
274-
)
270+
mock_connection.send_command.assert_called_once_with("SET", "key", "value")
275271

276272

277273
@pytest.mark.onlynoncluster
@@ -294,11 +290,7 @@ def test_pipeline_immediate_do_not_retry_write_on_read_failure(
294290
pipe.immediate_execute_command("SET", "key", "value")
295291

296292
# If read from socket fails, writes won't be executed.
297-
mock_connection.send_command.assert_has_calls(
298-
[
299-
call("SET", "key", "value"),
300-
]
301-
)
293+
mock_connection.send_command.assert_called_once_with("SET", "key", "value")
302294

303295

304296
@pytest.mark.skipif(sys.version_info == (3, 9), reason="Flacky test on Python 3.9")

0 commit comments

Comments
 (0)