Skip to content

Commit

Permalink
Start testing Coordinator #17
Browse files Browse the repository at this point in the history
  • Loading branch information
numberoverzero committed Oct 15, 2016
1 parent 29fd245 commit c53b812
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bloop/stream/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def __init__(self, *, engine, session: SessionWrapper, stream_arn: str):
# shard.iterator_type = "after_record"
self.buffer = RecordBuffer()

def __repr__(self):
# <Coordinator[.../StreamCreation-travis-661.2/stream/2016-10-03T06:17:12.741]>
return "<{}[{}]>".format(self.__class__.__name__, self.stream_arn)

def __next__(self) -> Optional[Dict[str, Any]]:
# Try to get the next record from each shard and push it into the buffer.
if not self.buffer:
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/test_stream/test_coordinator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from bloop.stream.coordinator import Coordinator


def test_coordinator_repr(engine, session):
stream_arn = "stream-arn"
coordinator = Coordinator(engine=engine, session=session, stream_arn=stream_arn)
assert repr(coordinator) == "<Coordinator[stream-arn]>"

0 comments on commit c53b812

Please sign in to comment.