def test_VotingInstruction():
    rls = LockSet(len(validators))
    bh = '1' * 32
    for i, privkey in enumerate(privkeys):
        if i < 4:  # quorum possible
            v = VoteBlock(height=2, round=0, blockhash=bh)

        else:
            v = VoteNil(height=2, round=0)
        v.sign(privkey)
        rls.add(v)
    assert rls.has_quorum_possible
    bp = VotingInstruction(height=2, round=1, round_lockset=rls)
    bp.sign(privkeys[0])
    assert bh == bp.blockhash

    # noquorum
    rls = LockSet(len(validators))
    for i, privkey in enumerate(privkeys):
        if i < 3:  # noquorum possible
            v = VoteBlock(height=2, round=0, blockhash=bh)
        else:
            v = VoteNil(height=2, round=0)
        v.sign(privkey)
        rls.add(v)
    assert not rls.has_quorum_possible
    assert rls.has_noquorum
    with pytest.raises(InvalidProposalError):  # QuorumPossiblle necessary R0
        bp = VotingInstruction(height=2, round=1, round_lockset=rls)

    # noquorum
    rls = LockSet(len(validators))
    for i, privkey in enumerate(privkeys):
        if 3 < i:  # noquorum possible
            v = VoteBlock(height=2, round=0, blockhash=bh)
        else:
            v = VoteNil(height=2, round=0)

        v.sign(privkey)
        rls.add(v)
    assert not rls.has_quorum_possible
    assert rls.has_noquorum
    with pytest.raises(InvalidProposalError):  # QuorumPossiblle necessary R0
        bp = VotingInstruction(height=2, round=1, round_lockset=rls)
dataset/ETHPy150Open HydraChain/hydrachain/hydrachain/tests/test_base.py/test_VotingInstruction/swapped operands of `<`