onuar / dokuztas Goto Github PK
View Code? Open in Web Editor NEWBlockchain ve cryptocurrency'leri (Bitcoin gibi) daha iyi anlayabilmek için, Türkçe dokümante edilen bir Python implementasyonu
License: MIT License
Blockchain ve cryptocurrency'leri (Bitcoin gibi) daha iyi anlayabilmek için, Türkçe dokümante edilen bir Python implementasyonu
License: MIT License
Aşağıdada gördüğüm kadarıyla başlangıç bloğunun hash değeri 0 olarak veriliyor.
dokuztas/dokuztas/blockchain.py
Line 17 in 80f4fa0
Fakat kriptoparalarda başlangıç bloğuda bir hash değerine sahip.
Başlangıç bloğununda bir hash değerine sahip olması daha doğru olmaz mı?
Ubuntu 16.04 LTS kullanıyorum.
Ubuntu'da şu an python3'ün stabil sürümü 3.5.2
Aşağıdaki çıktı testleri çalıştırdığımda geliyor:
ozgun@VTITUL05775:~/OTHERS/dokuztas$ source dokuztas/venv/bin/activate
(venv) ozgun@VTITUL05775:~/OTHERS/dokuztas$ pytest
================================== test session starts ==================================
platform linux -- Python 3.5.2, pytest-3.2.2, py-1.4.34, pluggy-0.4.0
rootdir: /home/ozgun/OTHERS/dokuztas, inifile:
collected 25 items
tests/test_blockchain.py ............
tests/test_nas.py ..
tests/test_node.py ......F....
======================================= FAILURES ========================================
_____ test_if_first_pendingblock_is_just_created_then_mining_should_be_started_once _____
def test_if_first_pendingblock_is_just_created_then_mining_should_be_started_once():
node = NodeComponent(miner=True)
node.create_genesis_chain()
patcher = patch('dokuztas.node.NodeComponent.mine')
mock = patcher.start()
for x in range(0, 200):
node.add_transaction(x)
patcher.stop()
> mock.assert_called_once()
tests/test_node.py:80:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MagicMock name='mine' id='139783682489088'>, name = 'assert_called_once'
def __getattr__(self, name):
if name in {'_mock_methods', '_mock_unsafe'}:
raise AttributeError(name)
elif self._mock_methods is not None:
if name not in self._mock_methods or name in _all_magics:
raise AttributeError("Mock object has no attribute %r" % name)
elif _is_magic(name):
raise AttributeError(name)
if not self._mock_unsafe:
if name.startswith(('assert', 'assret')):
> raise AttributeError(name)
E AttributeError: assert_called_once
/usr/lib/python3.5/unittest/mock.py:583: AttributeError
--------------------------------- Captured stdout call ----------------------------------
>>> info: Genesis! Blockchain ilk kez oluşturuldu.
>>> info: Nonce bulundu! Nonce: 51597 Block_hash: 00009b8539d913411b8dd95aa3a449593dc454ef0ddc87955bd48d8ff48a926a
========================== 1 failed, 24 passed in 3.55 seconds ==========================
Şunu değiştirdiğimde testlerin hepsi geçiyor:
dokuztas/tests/test_node.py:80:
- mock.assert_called_once()
+ mock.assert_called_once_with()
pytest'in API'na hakim değilim, sadece stackoverflow buna yönlendirdi :D PR gönderebilirim, diğer işletim sistemlerinde de normal çalışacağını düşünüyorsan.
Sabit bir sunucu değilde dağıtık bir ağ nasıl kurulur ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.