add doctest to _reverseBytes (not detected due to _memoize)

This commit is contained in:
Rob Hagemans 2023-07-22 15:46:19 +01:00
parent 642352f0f5
commit 0e691fb432

View File

@ -271,6 +271,12 @@ def _memoize(f):
# opposite of what makes sense algorithmically and hence this function.
@_memoize
def _reverseBytes(data):
r"""
>>> bin(ord(_reverseBytes(0b00100111)))
'0b11100100'
>>> _reverseBytes(b'\x00\xf0')
b'\x00\x0f'
"""
if isinstance(data, bytes) and len(data) != 1:
return bytesjoin(map(_reverseBytes, data))
byte = byteord(data)