def test_read_value_max_padding(self): encoding = (b'\x48\x00\x00\x00\x00\x00\x00\x00') self.stream = BytearrayStream(encoding) ts = TextString() ts.length = 0x01 ts.read_value(self.stream) expected = 'H' self.assertEqual(expected, ts.value, self.bad_read.format('value', expected, ts.value))
def test_read_value_no_padding(self): encoding = (b'\x48\x65\x6C\x6C\x6F\x20\x57\x6F') self.stream = BytearrayStream(encoding) ts = TextString() ts.length = 0x08 ts.read_value(self.stream) expected = 'Hello Wo' self.assertEqual(expected, ts.value, self.bad_read.format('value', expected, ts.value))