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.
This commit is contained in:
Luke Murphy
2019-08-01 17:21:28 +02:00
parent 43ecd33215
commit 065eb1fdac
5 changed files with 124 additions and 106 deletions

View File

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