Skip to content

Commit 0314ccf

Browse files
author
chenyunliang520
committed
Fix Faker byte-like object matching to allow None/empty values and exact match otherwise
1 parent 4d4aed7 commit 0314ccf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/fix_faker.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,11 @@ def example(self, spec):
315315
def match_any(self, spec, got, want):
316316
if spec == dt.timedelta:
317317
assert abs((got - want).total_seconds()) < 86400 * 2
318+
elif spec in (bytes, bytearray, memoryview):
319+
if want in (b'', bytearray(b'')) or want is None:
320+
assert got in (None, b'', bytearray(b''), memoryview(b''))
321+
else:
322+
assert got == want
318323
else:
319324
assert got == want
320325

0 commit comments

Comments
 (0)