Skip to content

Commit

Permalink
standardize expecting objects representation (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
jejung authored Dec 13, 2024
1 parent ea97430 commit ef8fedf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/expecting/dict/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __eq__(self, other: Any) -> bool:
return True

def __repr__(self) -> str:
return f"~= {self.expected}"
return f"~= <{self.expected!r}>"


def containing(expected: Dict[Any, Union[Any, Expecting]]) -> Expecting:
Expand Down
2 changes: 1 addition & 1 deletion src/expecting/list/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, expected: Sequence[Any], strict: bool = True):
self.expected = expected

def __repr__(self) -> str:
return f'~= {self.expected!r}'
return f'~= <{self.expected!r}>'

def __eq__(self, current: Any) -> bool:
if not isinstance(current, (list, tuple)):
Expand Down
2 changes: 1 addition & 1 deletion src/expecting/number/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __eq__(self, other):
return self.resolve_op()(other, self.right_side)

def __repr__(self) -> str:
return f'~= number {self.op} {self.right_side}'
return f'~= <number {self.op} {self.right_side}>'


def ge(right: KnownNumberType) -> ExpectingNumber:
Expand Down
4 changes: 2 additions & 2 deletions src/expecting/string/uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def __eq__(self, other: Any) -> bool:

def __repr__(self) -> str:
if self.expected_version is None:
return '~= UUID hex string'
return f'~= UUIDv{self.expected_version} hex string'
return '~= <UUID hex as string>'
return f'~= <UUIDv{self.expected_version} hex as string>'


def v1() -> Expecting:
Expand Down

0 comments on commit ef8fedf

Please sign in to comment.