From 91dbf844ad923e3c4bca1252dd104d8fc8ce5475 Mon Sep 17 00:00:00 2001 From: Dave Hibberd Date: Mon, 16 Oct 2023 21:37:27 +0100 Subject: New upstream version 20231016 --- tests/unit/test_util.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/unit/test_util.py (limited to 'tests/unit/test_util.py') diff --git a/tests/unit/test_util.py b/tests/unit/test_util.py new file mode 100644 index 0000000..461f3d2 --- /dev/null +++ b/tests/unit/test_util.py @@ -0,0 +1,19 @@ +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)) -- cgit v1.2.3