From f9fc1062bb582f3fab63888e75605ab3f063ac4b Mon Sep 17 00:00:00 2001 From: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu, 30 Jul 2020 15:41:29 +0200 Subject: [PATCH] add ImmutableDict.__repr__ It can help in pytest's diffs --- swh/model/collections.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/swh/model/collections.py b/swh/model/collections.py index 38d28a32..5fd8f682 100644 --- a/swh/model/collections.py +++ b/swh/model/collections.py @@ -26,6 +26,9 @@ class ImmutableDict(Mapping, Generic[KT, VT]): else: self.data = tuple(data) + def __repr__(self): + return f"ImmutableDict({dict(self.data)!r})" + def __getitem__(self, key): for (k, v) in self.data: if k == key: -- GitLab