def test_bytewise_invalid(self, limit): exception = ValueError if isinstance(limit, int) else TypeError with raises(exception): bytewise(b'python', limit=limit)
def test_bytewise_show_len(self): operand = bytes.fromhex(' '.join((f'{i:02X}' for i in range(256)))) expected = '00 01 02 03 04 05 06 07 .. FF' assert bytewise(operand, limit=10, show_len=False) == expected assert bytewise(operand, limit=10) == expected + ' (256 bytes)'
def test_bytewise_big(self): expected = ' '.join(''.join(choices('0123456789ABCDEF', k=2)) for _ in range(2**16 + 1)) operand = bytes.fromhex(expected) assert bytewise(operand) == expected
def test_bytewise_limit(self, data_bytewise_limit): operand, expected, limit = data_bytewise_limit assert bytewise(operand, sep='-', limit=limit, show_len=False) == expected
def test_bytewise_sep(self, data_bytewise, sep): operand, expected = data_bytewise expected = expected.replace(' ', sep) assert bytewise(operand, sep=sep) == expected
def test_bytewise(self, data_bytewise): operand, expected = data_bytewise assert bytewise(operand) == expected