merkle-tree-stream/test/conftest.py
Luke Murphy 065eb1fdac
Focus on Iterator protocol - tests passing!
Too much naming copy/pasta will probably confuse Python programmers when
we have generator/iterators and I suppose we have streams but that is
just so generic that it won't help.

So, better make it explicit that this is an iterator.

It also seems to the fit the usage of the other implementors.
2019-08-01 17:21:28 +02:00

23 lines
385 B
Python

import hashlib
import pytest
@pytest.fixture
def leaf():
def _leaf(node, roots=None):
return hashlib.sha256(node.data).hexdigest()
return _leaf
@pytest.fixture
def parent():
def _parent(first, second):
sha256 = hashlib.sha256()
sha256.update(first.data)
sha256.update(second.data)
return sha256.hexdigest()
return _parent