mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-09 22:16:10 +03:00
add __repr__ methods for catala types
This commit is contained in:
parent
75f1ea3d5e
commit
5367ef65b7
@ -178,6 +178,9 @@ class Money:
|
||||
def __str__(self) -> str:
|
||||
return "${:.2}".format(self.value.value / 100)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"Money({self.value.__repr__()})"
|
||||
|
||||
|
||||
class Date:
|
||||
def __init__(self, value: datetime.date) -> None:
|
||||
@ -216,6 +219,9 @@ class Date:
|
||||
def __str__(self) -> str:
|
||||
return self.value.__str__()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"Date({self.value.__repr__()})"
|
||||
|
||||
|
||||
class Duration:
|
||||
def __init__(self, value: dateutil.relativedelta.relativedelta) -> None:
|
||||
@ -277,6 +283,9 @@ class Duration:
|
||||
def __str__(self) -> str:
|
||||
return self.value.__str__()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"Duration({self.value.__repr__()})"
|
||||
|
||||
|
||||
class Unit:
|
||||
def __init__(self) -> None:
|
||||
@ -297,6 +306,9 @@ class Unit:
|
||||
def __str__(self) -> str:
|
||||
return "()"
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return "Unit()"
|
||||
|
||||
|
||||
class SourcePosition:
|
||||
def __init__(self,
|
||||
|
Loading…
Reference in New Issue
Block a user