@@ -3370,3 +3370,38 @@ async def test_get_subnet_info_no_data(mocker, subtensor):
3370
3370
)
3371
3371
async_subtensor .SubnetInfo .from_dict .assert_not_called ()
3372
3372
assert result is None
3373
+
3374
+
3375
+ @pytest .mark .parametrize (
3376
+ "call_return, expected" ,
3377
+ [[10 , 111 ], [None , None ], [0 , 121 ]],
3378
+ )
3379
+ @pytest .mark .asyncio
3380
+ async def test_get_next_epoch_start_block (mocker , subtensor , call_return , expected ):
3381
+ """Check that get_next_epoch_start_block returns the correct value."""
3382
+ # Prep
3383
+ netuid = mocker .Mock ()
3384
+ block = 20
3385
+
3386
+ fake_block_hash = mocker .Mock ()
3387
+ mocker .patch .object (subtensor , "get_block_hash" , return_value = fake_block_hash )
3388
+
3389
+ mocked_blocks_since_last_step = mocker .AsyncMock (return_value = call_return )
3390
+ subtensor .blocks_since_last_step = mocked_blocks_since_last_step
3391
+
3392
+ mocker .patch .object (subtensor , "tempo" , return_value = 100 )
3393
+
3394
+ # Call
3395
+ result = await subtensor .get_next_epoch_start_block (netuid = netuid , block = block )
3396
+
3397
+ # Asserts
3398
+ mocked_blocks_since_last_step .assert_called_once_with (
3399
+ netuid = netuid ,
3400
+ block = block ,
3401
+ block_hash = fake_block_hash ,
3402
+ reuse_block = False ,
3403
+ )
3404
+ subtensor .tempo .assert_awaited_once_with (
3405
+ netuid = netuid , block = block , block_hash = fake_block_hash , reuse_block = False
3406
+ )
3407
+ assert result == expected
0 commit comments