def test_newTransaction(self): # Create a new transaction txn = Transaction() txn.setContent(self.byte_content) digest = txn.getDigest() # Verify the header digest from farming to # the expected one self.assertEqual( digest.hex(), self.expected_transaction_digest, 'Wrong transaction digest') # Check the contents of the full block against # the expected content inBytes = txn.toBytes() self.assertEqual(inBytes.hex(), self.expected_full_transaction, 'Wrong full transaction content') with open('test_txn_one.dat', 'wb') as f: f.write(inBytes)