Skip to content

Commit 5b06a41

Browse files
committed
Define equality and __repr__ for RangeSummary
1 parent 0130128 commit 5b06a41

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pystac/summaries.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ def from_dict(cls, d: Dict[str, Any]) -> "RangeSummary[T]":
5959
maximum: T = get_required(d.get("maximum"), "RangeSummary", "maximum")
6060
return cls(minimum=minimum, maximum=maximum)
6161

62+
def __eq__(self, o: object) -> bool:
63+
if not isinstance(o, RangeSummary):
64+
return NotImplemented
65+
66+
return self.to_dict() == o.to_dict()
67+
68+
def __repr__(self) -> str:
69+
return self.to_dict().__repr__()
70+
6271

6372
FIELDS_JSON_URL = (
6473
"https://cdn.jsdelivr.net/npm/@radiantearth/stac-fields/fields-normalized.json"

0 commit comments

Comments
 (0)