mirror of
https://github.com/kk7ds/chirp
synced 2026-08-13 17:51:36 -04:00
Historically hexprint zero-pads the data it is printing, which makes it hard to see how much data is actually there. Fix that.
19 lines
637 B
Python
19 lines
637 B
Python
from chirp import util
|
|
from tests.unit import base
|
|
|
|
|
|
class TestUtils(base.BaseTest):
|
|
def test_hexprint_with_string(self):
|
|
util.hexprint('00000000000000')
|
|
|
|
def test_hexprint_with_bytes(self):
|
|
util.hexprint(b'00000000000000')
|
|
|
|
def test_hexprint_short(self):
|
|
expected = ('000: 00 00 00 00 00 00 00 00 ........\n'
|
|
'008: 00 ........\n')
|
|
self.assertEqual(expected, util.hexprint(b'\x00' * 9))
|
|
|
|
def test_hexprint_even(self):
|
|
expected = '000: 00 00 00 00 00 00 00 00 ........\n'
|
|
self.assertEqual(expected, util.hexprint(b'\x00' * 8))
|