Feat: add __repr__ and to_dict

This commit is contained in:
Bertrand Benjamin 2022-12-21 06:53:12 +01:00
parent b4df4d6c09
commit 309e9627e7
1 changed files with 6 additions and 0 deletions

View File

@ -25,3 +25,9 @@ class Tribe:
if isinstance(other, Tribe):
return self.name == other.name
return False
def __repr__(self) -> str:
return f"<Tribe {self.name=}>"
def to_dict(self) -> dict:
return {"name": self.name, "level": self.level}