File: test_utils.py

package info (click to toggle)
chirp 1%3A20221106%2Bpy3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,144 kB
  • sloc: python: 119,334; ansic: 296; sh: 184; makefile: 41
file content (21 lines) | stat: -rw-r--r-- 539 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
20
21
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_struct_pack(self):
        struct = util.StringStruct

        self.assertEqual('\x00c',
                         struct.pack('bc', 0, 'c'))

    def test_struct_unpack(self):
        struct = util.StringStruct

        self.assertEqual((1, 'c'), struct.unpack('bc', '\x01c'))