コード例 #1
0
def test_is_valid_chain_bad_genesis(blockchain_three_blocks):
    blockchain_three_blocks.chain[0].hash = 'evil_hash'

    with pytest.raises(Exception, match='genesis block must be valid'):
        Blockchain.is_valid_chain(blockchain_three_blocks.chain)
コード例 #2
0
def test_is_valid_chain(blockchain_three_blocks):
    # Compare two different instances of the same class in python, it will results as False.
    # E.g foo = Block.genesis(), bar = Block.genesis(), foo == bar => False
    Blockchain.is_valid_chain(blockchain_three_blocks.chain)