feat: repr

This commit is contained in:
Swann 2019-07-23 11:41:36 +02:00
parent 78f051a231
commit eec0d899dc
3 changed files with 10 additions and 4 deletions

View File

@ -183,10 +183,10 @@ class ReplicatedDatablock(object):
raise NotImplementedError raise NotImplementedError
def __repr__(self): def __repr__(self):
return "{uuid} - Owner: {owner} - ETA: {state} ".format( return "{uuid} - owner: {owner} - type: {type}".format(
uuid=self.uuid, uuid=self.uuid,
owner=self.owner, owner=self.owner,
state=self.state type=self.str_type
) )
class RepCommand(ReplicatedDatablock): class RepCommand(ReplicatedDatablock):

View File

@ -25,6 +25,12 @@ class ReplicationGraph(collections.MutableMapping):
def __len__(self): def __len__(self):
return len(self.store) return len(self.store)
def __repr__(self):
str = "\n"
for key,item in self.store.items():
str+=repr(item)
return str

View File

@ -8,7 +8,7 @@ import cProfile
import re import re
log = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class SampleData(): class SampleData():
def __init__(self, map={"sample":"data"}): def __init__(self, map={"sample":"data"}):
@ -189,7 +189,7 @@ class TestClient(unittest.TestCase):
client.unregister(data_sample_key) client.unregister(data_sample_key)
logger.debug(client._rep_store)
client.disconnect() client.disconnect()
client2.disconnect() client2.disconnect()
server.stop() server.stop()