Skip to content

Commit

Permalink
Merge pull request #20 from ska-sa/format-bytes
Browse files Browse the repository at this point in the history
Use {!r} to format bytes
  • Loading branch information
bmerry committed Nov 28, 2019
2 parents 3db27a7 + 0739d59 commit 5cc5757
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions aiokatcp/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,10 @@ def decode(cls: Any, value: bytes) -> Any:
if len(values) == 1:
return values[0]
elif not values:
raise ValueError('None of the types in {} could decode {}'.format(
raise ValueError('None of the types in {} could decode {!r}'.format(
cls, value))
else:
raise ValueError('{} is ambiguous for {}'.format(value, cls))
raise ValueError('{!r} is ambiguous for {}'.format(value, cls))
else:
return get_type(cls).decode(cls, value)

Expand Down
2 changes: 1 addition & 1 deletion aiokatcp/test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def test_unknown_class(self) -> None:
def test_bad_raw(self) -> None:
for type_, value in self.BAD_VALUES:
with self.assertRaises(ValueError,
msg='{} should not be valid for {}'.format(value, type_)):
msg='{!r} should not be valid for {}'.format(value, type_)):
decode(type_, value)

@unittest.mock.patch('aiokatcp.core._types', []) # type: ignore
Expand Down

0 comments on commit 5cc5757

Please sign in to comment.