Exemplo n.º 1
0
 def test_parse_custom_length_field(self):
     s = PascalString("foo", length_field=UBInt16("length"), encoding="utf8")
     self.assertEqual(s.parse(six.b("\x00\x05hello")), six.u("hello"))
Exemplo n.º 2
0
 def test_parse_custom_length_field(self):
     s = PascalString("foo",
                      length_field=UBInt16("length"),
                      encoding="utf8")
     self.assertEqual(s.parse(six.b("\x00\x05hello")), six.u("hello"))
Exemplo n.º 3
0
 def test_parse(self):
     s = PascalString("foo", encoding="utf8")
     self.assertEqual(s.parse(six.b("\x05hello")), six.u("hello"))
Exemplo n.º 4
0
 def test_parse(self):
     s = PascalString("foo", encoding="utf8")
     self.assertEqual(s.parse(six.b("\x05hello")), six.u("hello"))
Exemplo n.º 5
0
 def test_parse_custom_length_field(self):
     s = PascalString("foo", length_field=UBInt16("length"))
     self.assertEqual(s.parse(b"\x00\x05hello"), b"hello")
Exemplo n.º 6
0
 def test_parse(self):
     s = PascalString("foo")
     self.assertEqual(s.parse(b"\x05hello"), b"hello")
Exemplo n.º 7
0
 def test_parse_custom_length_field(self):
     s = PascalString("s", lengthfield=UBInt16(None), encoding="utf8")
     self.assertEqual(s.parse(b"\x00\x05hello"), u"hello")
Exemplo n.º 8
0
 def test_parse(self):
     s = PascalString("s", encoding="utf8")
     self.assertEqual(s.parse(b"\x05hello"), u"hello")
     s = PascalString("s")
     self.assertEqual(s.parse(b"\x05hello"), b"hello")