File: test_010_binary_data.py

package info (click to toggle)
ezdxf 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104,528 kB
  • sloc: python: 182,341; makefile: 116; lisp: 20; ansic: 4
file content (21 lines) | stat: -rw-r--r-- 561 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
# Copyright (c) 2014-2019, Manfred Moitzi
# License: MIT License
from binascii import unhexlify
from ezdxf.tools.binarydata import hex_strings_to_bytes
from ezdxf.tools.binarydata import bytes_to_hexstr


def test_hexstr_to_bytes():
    assert unhexlify("FFFF") == b"\xff\xff"


def test_hexstr_data_to_bytes_1():
    assert hex_strings_to_bytes(["FFFF"]) == b"\xff\xff"


def test_hexstr_data_to_bytes_2():
    assert hex_strings_to_bytes(["F0F0", "1A1C"]) == b"\xF0\xF0\x1A\x1C"


def test_bytes_to_hexstr():
    assert bytes_to_hexstr(b"\xff\xff") == "FFFF"