Lines Matching refs:detokenize
28 from pw_tokenizer import detokenize
104 detok = detokenize.Detokenizer(
110 self.assertEqual(str(detok.detokenize(b'\xab\xcd\0\0\x02\x03Two\x66')),
114 detok = detokenize.Detokenizer(
121 result = detok.detokenize(b'\x01\0\0\0\x04args')
131 detok = detokenize.Detokenizer(
138 result = detok.detokenize(b'\x02\0\0\0')
147 detok = detokenize.Detokenizer(tokens.Database([
154 result = detok.detokenize(b'\x02\0\0\0')
163 detok = detokenize.Detokenizer(
170 result = detok.detokenize(b'\x01\0\0\0o_o')
177 detok = detokenize.Detokenizer(io.BytesIO(EMPTY_ELF))
178 self.assertFalse(detok.detokenize(b'\x12\x34\0\0').ok())
180 detok.detokenize(b'1234').error_message())
181 self.assertIn('unknown token', repr(detok.detokenize(b'1234')))
184 str(detok.detokenize(b'1234')))
186 self.assertIsNone(detok.detokenize(b'').token)
189 detok = detokenize.Detokenizer(io.BytesIO(EMPTY_ELF), show_errors=True)
190 self.assertFalse(detok.detokenize(b'\x12\x34\0\0').ok())
192 detok.detokenize(b'1234').error_message())
193 self.assertIn('unknown token', repr(detok.detokenize(b'1234')))
194 self.assertIn('unknown token', str(detok.detokenize(b'1234')))
196 self.assertIsNone(detok.detokenize(b'').token)
199 detok = detokenize.Detokenizer(io.BytesIO(EMPTY_ELF), show_errors=True)
200 self.assertIn('missing token', detok.detokenize(b'').error_message())
201 self.assertIn('missing token', str(detok.detokenize(b'')))
202 self.assertIn('missing token', repr(detok.detokenize(b'123')))
204 self.assertIn('missing token', detok.detokenize(b'1').error_message())
205 self.assertIn('missing token', str(detok.detokenize(b'1')))
206 self.assertIn('missing token', repr(detok.detokenize(b'1')))
209 detok.detokenize(b'123').error_message())
210 self.assertIn('missing token', str(detok.detokenize(b'123')))
211 self.assertIn('missing token', repr(detok.detokenize(b'123')))
214 detok = detokenize.Detokenizer(io.BytesIO(EMPTY_ELF))
215 self.assertIn('missing token', detok.detokenize(b'').error_message())
216 self.assertEqual('$', str(detok.detokenize(b'')))
217 self.assertIn('missing token', repr(detok.detokenize(b'123')))
219 self.assertIn('missing token', detok.detokenize(b'1').error_message())
221 str(detok.detokenize(b'1')))
222 self.assertIn('missing token', repr(detok.detokenize(b'1')))
225 detok.detokenize(b'123').error_message())
227 str(detok.detokenize(b'123')))
228 self.assertIn('missing token', repr(detok.detokenize(b'123')))
231 detok = detokenize.Detokenizer(io.BytesIO(ELF_WITH_TOKENIZER_SECTIONS))
233 self.assertTrue(detok.detokenize(JELLO_WORLD_TOKEN).ok())
234 self.assertEqual(str(detok.detokenize(JELLO_WORLD_TOKEN)),
237 undecoded_args = detok.detokenize(JELLO_WORLD_TOKEN + b'some junk')
241 self.assertTrue(detok.detokenize(b'\0\0\0\0').ok())
242 self.assertEqual(str(detok.detokenize(b'\0\0\0\0')), '')
245 detok = detokenize.Detokenizer(io.BytesIO(ELF_WITH_TOKENIZER_SECTIONS))
255 detok = detokenize.Detokenizer(fd)
261 detok = detokenize.Detokenizer(elf.name)
267 detok = detokenize.Detokenizer(elf_reader.Elf(fd))
275 detok = detokenize.Detokenizer(io.BytesIO(ELF_WITH_TOKENIZER_SECTIONS))
287 detok = detokenize.Detokenizer(csv_file.name)
293 detok = detokenize.Detokenizer(fd)
301 detok = detokenize.Detokenizer(io.BytesIO(ELF_WITH_TOKENIZER_SECTIONS))
304 detok = detokenize.Detokenizer(detok.database)
316 self.detok = detokenize.Detokenizer(tokens.Database([
334 no_args = self.detok.detokenize(b'\xad\xba\0\0')
344 multiple_correct = self.detok.detokenize(b'\xad\xba\0\0\x7a')
354 int_arg = self.detok.detokenize(b'\xad\xba\0\0\xfe\xff\xff\xff\x0f')
361 string_arg = self.detok.detokenize(b'\xad\xba\0\0\x02Hi')
366 result = self.detok.detokenize(b'\1\0\0\0\x83hi')
372 result = self.detok.detokenize(b'\2\0\0\0\1\2\1\4\5')
378 unambiguous = self.detok.detokenize(b'\xad\xba\0\0\x01#\x00\x01')
410 detok = detokenize.AutoUpdatingDetokenizer(file.name,
412 self.assertFalse(detok.detokenize(JELLO_WORLD_TOKEN).ok())
417 self.assertTrue(detok.detokenize(JELLO_WORLD_TOKEN).ok())
422 self.assertTrue(detok.detokenize(JELLO_WORLD_TOKEN).ok())
434 detok = detokenize.AutoUpdatingDetokenizer(file,
436 self.assertTrue(detok.detokenize(JELLO_WORLD_TOKEN).ok())
442 self.assertTrue(detok.detokenize(JELLO_WORLD_TOKEN).ok())
443 self.assertTrue(detok.detokenize(JELLO_WORLD_TOKEN).ok())
447 self.assertFalse(detok.detokenize(JELLO_WORLD_TOKEN).ok())
459 self.decode = detokenize.PrefixedMessageDecoder('$', 'abcdefg')
524 self.detok = detokenize.Detokenizer(db)
529 detokenize.detokenize_base64_live(self.detok, io.BytesIO(data),
537 detokenize.detokenize_base64_to_file(self.detok, data, output, '$')
544 expected, detokenize.detokenize_base64(self.detok, data, b'$'))
551 self.detok = detokenize.Detokenizer(
562 detokenize.detokenize_base64(self.detok,
569 detokenize.detokenize_base64(self.detok,
575 detokenize.detokenize_base64(self.detok,
581 detokenize.detokenize_base64(self.detok,