Skip to content

Commit

Permalink
Merge pull request #188 from KOSASIH/deepsource-transform-d4f01fe0
Browse files Browse the repository at this point in the history
style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf
  • Loading branch information
KOSASIH authored May 12, 2024
2 parents 31db2a0 + 9f29e8b commit 9388529
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/test_blockchain.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest

from blockchain import Blockchain


class TestBlockchain(unittest.TestCase):
def setUp(self):
self.blockchain = Blockchain()
Expand All @@ -10,16 +12,20 @@ def test_create_genesis_block(self):
self.assertEqual(self.blockchain.chain[0].previous_hash, "0" * 64)
self.assertEqual(self.blockchain.chain[0].data, "Genesis Block")
self.assertEqual(self.blockchain.chain[0].timestamp, 1234567890)
self.assertEqual(self.blockchain.chain[0].hash, "hash_value") # Replace with actual hash value
# Replace with actual hash value
self.assertEqual(self.blockchain.chain[0].hash, "hash_value")

def test_add_block(self):
self.blockchain.add_block("data")
self.assertEqual(len(self.blockchain.chain), 2)
self.assertEqual(self.blockchain.chain[1].index, 1)
self.assertEqual(self.blockchain.chain[1].previous_hash, self.blockchain.chain[0].hash)
self.assertEqual(
self.blockchain.chain[1].previous_hash, self.blockchain.chain[0].hash
)
self.assertEqual(self.blockchain.chain[1].data, "data")
self.assertEqual(self.blockchain.chain[1].timestamp, 1234567891)
self.assertEqual(self.blockchain.chain[1].hash, "hash_value") # Replace with actual hash value
# Replace with actual hash value
self.assertEqual(self.blockchain.chain[1].hash, "hash_value")

def test_is_valid(self):
self.assertTrue(self.blockchain.is_valid())
Expand Down

0 comments on commit 9388529

Please sign in to comment.