def test_LockSet_isvalid():
    ls = LockSet(num_eligible_votes=len(privkeys))
    bh = '0' * 32
    r, h = 2, 3

    votes = [VoteBlock(h, r, bh) for i in range(len(privkeys))]
    for i, v in enumerate(votes):
        v.sign(privkeys[i])
        ls.add(v)
        assert len(ls) == i + 1
        if len(ls) < ls.num_eligible_votes * 2 / 3.:
            assert not ls.is_valid
        else:
            assert ls.is_valid
            assert ls.has_quorum  # same blockhash
        ls.check()
dataset/ETHPy150Open HydraChain/hydrachain/hydrachain/tests/test_base.py/test_LockSet_isvalid/original