def test_bad_length(self): """Test convert_ATvalue with bad length bytestring""" bytestring = b'' assert convert_ATvalue(bytestring, True) == '' bytestring = b'\x10\x00\x20\x00\x10\x00\x30\x00\x10' convert_ATvalue(bytestring, True)
def test_little_endian(self): """Test convert_ATvalue with a little endian byte string""" # VM 1 bytestring = b'\x10\x00\x20\x00' assert convert_ATvalue(bytestring, True) == Tag(0x0010, 0x0020) # VM 3 bytestring += b'\x10\x00\x30\x00\x10\x00\x40\x00' out = convert_ATvalue(bytestring, True) assert Tag(0x0010, 0x0020) in out assert Tag(0x0010, 0x0030) in out assert Tag(0x0010, 0x0040) in out
def test_big_endian(self): """Test convert_ATvalue with a big endian byte string""" # VM 1 bytestring = b'\x00\x10\x00\x20' assert convert_ATvalue(bytestring, False) == Tag(0x0010, 0x0020) # VM 3 bytestring += b'\x00\x10\x00\x30\x00\x10\x00\x40' out = convert_ATvalue(bytestring, False) assert Tag(0x0010, 0x0020) in out assert Tag(0x0010, 0x0030) in out assert Tag(0x0010, 0x0040) in out
def test_empty_bytestring(self): """Test convert_ATvalue with empty bytestring""" bytestring = b'' assert convert_ATvalue(bytestring, True) == []