예제 #1
0
def test_genesis():
    genesis = Block.genesis()

    assert isinstance(genesis, Block)
    # every attirubte matches attribute in genesis block dictionary
    for key, value in GENESIS_DATA.items():
        getattr(genesis, key) == value
예제 #2
0
def test_genesis():
    genesis = Block.genesis()

    assert isinstance(genesis, Block)

    for key, value in GENESIS_DATA.items():
        getattr(genesis, key) == value
예제 #3
0
def test_genesis():
    genesis = Block.genesis()

    # function returns True if the specified object is of the specified type
    assert isinstance(genesis, Block)
    for key, value in GENESIS_DATA.items():
        getattr(genesis, key) == value
예제 #4
0
def test_genesis():
    genesis = Block.genesis()

    assert isinstance(genesis, Block)

    # Loop through the const genesis, and compare genesis data with the const data
    for key, value in GENESIS_DATA.items():
        getattr(genesis, key) == value
예제 #5
0
def test_genesis():
    genesis = Block.genesis()
    assert isinstance(genesis, Block)
    assert genesis.timestamp == GENESIS_DATA['timestamp']
    assert genesis.last_hash == GENESIS_DATA['last_hash']
    assert genesis.hash == GENESIS_DATA['hash']
    assert genesis.data == GENESIS_DATA['data']
    for key, value in GENESIS_DATA.items():
        getattr(genesis, key) == value
예제 #6
0
def test_genesis():
    genesis = Block.genesis()

    assert isinstance(genesis, Block)
    # assert genesis.timestamp == GENESIS_DATA['timestamp']
    # assert genesis.last_hash == GENESIS_DATA['last_hash']
    # assert genesis.hash == GENESIS_DATA['hash']
    # assert genesis.data == GENESIS_DATA['data']

    for attr_name, attr_value in GENESIS_DATA.items():
        assert getattr(genesis, attr_name) == attr_value
예제 #7
0
def test_genesis():
    genesis = Block.genesis()

    assert isinstance(genesis, Block)
    # assert genesis.timestamp == GENESIS_DATA["timestamp"]
    # assert genesis.last_hash == GENESIS_DATA["last_hash"]
    # assert genesis.hash == GENESIS_DATA["hash"]
    # assert genesis.data == GENESIS_DATA["data"]

    for key, value in GENESIS_DATA.items():
        getattr(genesis, key) == value
def test_genesis():
    genesis = Block.genesis()

    #refactored(all parts of genesis block) with a for loop, using the key and value of genesis
    #by creating a get attribute and assigning genesis to the value of key

    #additional print statements can be seen by running the
    # -rP flag for passed tests || -rx flag for failed tests
    #  pytest -rP                  pytest -rx

    assert isinstance(genesis, Block)

    for key, value in GENESIS_DATA.items():
        getattr(genesis, key) == value
예제 #9
0
def test_genesis():
    genesis = Block.genesis()

    assert isinstance(genesis, Block)

    # assert genesis.timestamp == GENESIS_DATA['timestamp']
    # assert genesis.last_hash == GENESIS_DATA['last_hash']
    # assert genesis.hash == GENESIS_DATA['hash']
    # assert genesis.data == GENESIS_DATA['data']

    #we are using for loop instead of the above line to reduce the redundancy

    for key, value in GENESIS_DATA.items():
        getattr(genesis, key) == value
예제 #10
0
def test_genesis(last_block):

    assert isinstance(last_block, Block)

    for key, value in GENESIS_DATA.items():
        assert getattr(last_block, key) == value
예제 #11
0
def test_genesis():
    genesis_block = Block.genesis()

    for key, value in GENESIS_DATA.items():
        assert getattr(genesis_block, key) == value
예제 #12
0
def test_genesis_block():
    genesis_block = Block.generate_genesis()

    assert isinstance(genesis_block, Block)
    for k, v in GENESIS_DATA.items():
        assert getattr(genesis_block, k) == v
예제 #13
0
def test_genesis():
    genesis = Block.genesis()
    for key, value in GENESIS_DATA.items():
        getattr(genesis, key) == value