Skip to content

Commit dbf1c91

Browse files
authored
refactor(matchers): use !r f-string syntax instead of repr(...) (#199)
1 parent 5e5e6e7 commit dbf1c91

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

decoy/matchers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def __repr__(self) -> str:
8686
if self._attributes is None:
8787
return f"<IsA {self._match_type.__name__}>"
8888
else:
89-
return f"<IsA {self._match_type.__name__} {repr(self._attributes)}>"
89+
return f"<IsA {self._match_type.__name__} {self._attributes!r}>"
9090

9191

9292
def IsA(match_type: type, attributes: Optional[Mapping[str, Any]] = None) -> Any:
@@ -126,7 +126,7 @@ def __eq__(self, target: object) -> bool:
126126

127127
def __repr__(self) -> str:
128128
"""Return a string representation of the matcher."""
129-
return f"<IsNot {repr(self._reject_value)}>"
129+
return f"<IsNot {self._reject_value!r}>"
130130

131131

132132
def IsNot(value: object) -> Any:
@@ -164,7 +164,7 @@ def __eq__(self, target: object) -> bool:
164164

165165
def __repr__(self) -> str:
166166
"""Return a string representation of the matcher."""
167-
return f"<HasAttributes {repr(self._attributes)}>"
167+
return f"<HasAttributes {self._attributes!r}>"
168168

169169

170170
def HasAttributes(attributes: Mapping[str, Any]) -> Any:
@@ -207,7 +207,7 @@ def __eq__(self, target: object) -> bool:
207207

208208
def __repr__(self) -> str:
209209
"""Return a string representation of the matcher."""
210-
return f"<DictMatching {repr(self._values)}>"
210+
return f"<DictMatching {self._values!r}>"
211211

212212

213213
def DictMatching(values: Mapping[str, Any]) -> Any:
@@ -238,7 +238,7 @@ def __eq__(self, target: object) -> bool:
238238

239239
def __repr__(self) -> str:
240240
"""Return a string representation of the matcher."""
241-
return f"<StringMatching {repr(self._pattern.pattern)}>"
241+
return f"<StringMatching {self._pattern.pattern!r}>"
242242

243243

244244
def StringMatching(match: str) -> str:

0 commit comments

Comments
 (0)