eaapi/tests/test_decoder.py
2022-02-03 20:55:07 +00:00

24 lines
778 B
Python

import unittest
from eaapi.decoder import Decoder
class TestDecoder(unittest.TestCase):
def test_packed_names(self):
decoder = Decoder(b"\x13\xe6\xda\xa5\xdb\xab\xa8\xc2\x59\xf7\xd3\xcc\xe5\xaf\x4f\x40")
decoder.compressed = True
self.assertEqual(decoder._read_metadata_name(), "the_quick_brown_fox")
def test_short_ascii_names(self):
decoder = Decoder(b"\x52the_quick_brown_fox")
decoder.encoding = "shift-jis"
self.assertEqual(decoder._read_metadata_name(), "the_quick_brown_fox")
def test_long_ascii_names(self):
decoder = Decoder(b"\x80\x87" + b"the_quick_brown_fox_" * 10)
decoder.encoding = "shift-jis"
self.assertEqual(decoder._read_metadata_name(), "the_quick_brown_fox_" * 10)