File: test_util.py

package info (click to toggle)
chirp 1%3A20251108-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,728 kB
  • sloc: python: 156,369; ansic: 296; sh: 219; xml: 24; makefile: 19
file content (19 lines) | stat: -rw-r--r-- 637 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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))