File: base16_decoder.py

package info (click to toggle)
dfvfs 20201219-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 284,900 kB
  • sloc: python: 30,025; vhdl: 1,921; sh: 465; makefile: 16
file content (33 lines) | stat: -rw-r--r-- 845 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
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the base16 decoder object."""

from __future__ import unicode_literals

import unittest

from dfvfs.encoding import base16_decoder
from dfvfs.lib import errors

from tests.encoding import test_lib


class Base16DecoderTestCase(test_lib.DecoderTestCase):
  """Tests for the base16 decoder object."""

  def testDecode(self):
    """Tests the Decode method."""
    decoder = base16_decoder.Base16Decoder()

    decoded_data, _ = decoder.Decode(b'0102030405060708')
    expected_decoded_data = b'\x01\x02\x03\x04\x05\x06\x07\x08'
    self.assertEqual(decoded_data, expected_decoded_data)

    decoder = base16_decoder.Base16Decoder()

    with self.assertRaises(errors.BackEndError):
      decoder.Decode(b'\x01\x02\x03\x04\x05\x06\x07\x08')


if __name__ == '__main__':
  unittest.main()