summaryrefslogtreecommitdiff
path: root/tests/unit/test_util.py
diff options
context:
space:
mode:
authorDave Hibberd <d@vehibberd.com>2023-10-16 21:37:34 +0100
committerDave Hibberd <d@vehibberd.com>2023-10-16 21:37:34 +0100
commit96e7558ee5db759a7214cd451a3478f3b44f59a3 (patch)
treee673aa5fb96256d43311c0e9581a2d5c6141ace6 /tests/unit/test_util.py
parenta289d9178e89abd7dc0fb29bdd6dedf3987b4f06 (diff)
parent91dbf844ad923e3c4bca1252dd104d8fc8ce5475 (diff)
Update upstream source from tag 'upstream/20231016'
Update to upstream version '20231016' with Debian dir cd57b3fbc431f25a1408f045533dcb7f7b9975c0
Diffstat (limited to 'tests/unit/test_util.py')
-rw-r--r--tests/unit/test_util.py19
1 files changed, 19 insertions, 0 deletions
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))