Skip to content

Commit

Permalink
Only allow "assertBytesEqual" for bytes.
Browse files Browse the repository at this point in the history
  • Loading branch information
exhuma committed Oct 5, 2016
1 parent 7445e67 commit 0c8dd57
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions puresnmp/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def assertBytesEqual(self, a, b):
"""
Helper method to compare bytes with more helpful output.
"""
if not isinstance(a, bytes) or not isinstance(b, bytes):
raise ValueError('assertBytesEqual requires two bytes objects!')

if a != b:
comparisons = []
for offset, (char_a, char_b) in enumerate(zip_longest(a, b)):
Expand Down

0 comments on commit 0c8dd57

Please sign in to comment.