コード例 #1
0
def test_validate_block_slot(sample_beacon_state_params,
                             sample_beacon_block_params, state_slot,
                             block_slot, expected):
    state = BeaconState(**sample_beacon_state_params).copy(slot=state_slot, )
    block = BeaconBlock(**sample_beacon_block_params).copy(slot=block_slot, )
    if isinstance(expected, Exception):
        with pytest.raises(ValidationError):
            validate_block_slot(state, block)
    else:
        validate_block_slot(state, block)
コード例 #2
0
def test_validate_block_slot(
    sample_beacon_state_params,
    sample_beacon_block_params,
    state_slot,
    block_slot,
    expected,
):
    state = BeaconState.create(**sample_beacon_state_params).set(
        "slot", state_slot)
    block = BeaconBlock.create(**sample_beacon_block_params).set(
        "slot", block_slot)
    if isinstance(expected, Exception):
        with pytest.raises(ValidationError):
            validate_block_slot(state, block)
    else:
        validate_block_slot(state, block)