diff options
| author | Christoph Berg <myon@debian.org> | 2020-03-31 17:57:07 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2020-03-31 17:57:07 +0200 |
| commit | c2bdd8f8d96bf5329672163cc0905a22589d26d3 (patch) | |
| tree | 76ce2d78c98a958f97dfb6128fee9c529a2a55aa /tests/unit/test_utils.py | |
| parent | b255867dd3e05fff714c5d3325c02596bf5854c8 (diff) | |
New upstream version 20200227+py3+20200213upstream/20200227+py3+20200213
Diffstat (limited to 'tests/unit/test_utils.py')
| -rw-r--r-- | tests/unit/test_utils.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py new file mode 100644 index 0000000..575f3e3 --- /dev/null +++ b/tests/unit/test_utils.py @@ -0,0 +1,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')) |
