Skip to content

Commit 9d9085c

Browse files
committed
add unit tests
1 parent cac7ed5 commit 9d9085c

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

tests/unit_tests/test_async_subtensor.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6327,13 +6327,33 @@ async def test_mev_submit_encrypted_default_params(subtensor, fake_wallet, mocke
63276327
@pytest.mark.asyncio
63286328
async def test_is_fast_blocks(subtensor, mocker, fast_or_not, expected_result):
63296329
"""Verifies that `is_fast_blocks` calls proper method with proper parameters."""
6330-
mocked_query_constant = mocker.patch.object(
6331-
subtensor, "query_constant", return_value=fast_or_not
6330+
# Preps
6331+
mocked_get_start_call_delay = mocker.patch.object(
6332+
subtensor, "get_start_call_delay", return_value=fast_or_not
63326333
)
63336334

6335+
# Call
63346336
result = await subtensor.is_fast_blocks()
63356337

6336-
mocked_query_constant.assert_awaited_once_with(
6337-
"SubtensorModule", "InitialStartCallDelay"
6338-
)
6338+
# Asserts
6339+
mocked_get_start_call_delay.assert_awaited_once()
63396340
assert result == expected_result
6341+
6342+
6343+
@pytest.mark.asyncio
6344+
async def test_get_start_call_delay(subtensor, mocker):
6345+
"""Verifies that `get_start_call_delay` calls proper method with proper parameters."""
6346+
# Preps
6347+
mocked_query_subtensor = mocker.patch.object(subtensor, "query_subtensor")
6348+
6349+
# Call
6350+
result = await subtensor.get_start_call_delay()
6351+
6352+
# Asserts
6353+
mocked_query_subtensor.assert_awaited_once_with(
6354+
name="StartCallDelay",
6355+
block=None,
6356+
block_hash=None,
6357+
reuse_block=False,
6358+
)
6359+
assert result == mocked_query_subtensor.return_value

tests/unit_tests/test_subtensor.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6441,13 +6441,27 @@ def test_mev_submit_encrypted_default_params(subtensor, fake_wallet, mocker):
64416441
)
64426442
def test_is_fast_blocks(subtensor, mocker, fast_or_not, expected_result):
64436443
"""Verifies that `is_fast_blocks` calls proper method with proper parameters."""
6444-
mocked_query_constant = mocker.patch.object(
6445-
subtensor, "query_constant", return_value=fast_or_not
6444+
# Preps
6445+
mocked_get_start_call_delay = mocker.patch.object(
6446+
subtensor, "get_start_call_delay", return_value=fast_or_not
64466447
)
64476448

6449+
# Call
64486450
result = subtensor.is_fast_blocks()
64496451

6450-
mocked_query_constant.assert_called_once_with(
6451-
"SubtensorModule", "InitialStartCallDelay"
6452-
)
6452+
# Asserts
6453+
mocked_get_start_call_delay.assert_called_once()
64536454
assert result == expected_result
6455+
6456+
6457+
def test_get_start_call_delay(subtensor, mocker):
6458+
"""Verifies that `get_start_call_delay` calls proper method with proper parameters."""
6459+
# Preps
6460+
mocked_query_subtensor = mocker.patch.object(subtensor, "query_subtensor")
6461+
6462+
# Call
6463+
result = subtensor.get_start_call_delay()
6464+
6465+
# Asserts
6466+
mocked_query_subtensor.assert_called_once_with(name="StartCallDelay", block=None)
6467+
assert result == mocked_query_subtensor.return_value

0 commit comments

Comments
 (0)