def test_is_valid_block_jumped_difficulty(last_block, block):
        jumped_difficulty = 10
        block.difficulty = jumped_difficulty
        block.hash = f'{"0" * jumped_difficulty}111abc'

        with pytest.raises(Exception,
                           match='difficulty must only adjust by 1'):
            Block.is_valid_block(last_block, block)
    def test_is_valid_block_bad_block_hash(last_block, block):
        block.hash = '0000000000000000bbbabc'

        with pytest.raises(Exception, match='block hash must be correct'):
            Block.is_valid_block(last_block, block)
    def test_is_valid_block_bad_last_hash(last_block, block):
        block.last_hash = 'evil_last_hash'

        with pytest.raises(Exception, match='last_hash must be correct'):
            Block.is_valid_block(last_block, block)
    def test_is_valid_block_bad_proof_of_work(last_block, block):
        block.hash = 'fff'

        with pytest.raises(Exception,
                           match='proof of work requirement was not met'):
            Block.is_valid_block(last_block, block)
 def test_is_valid_block(last_block, block):
     Block.is_valid_block(last_block, block)