Esempio n. 1
0
 def test_build_custom_length_field(self):
     s = PascalString("foo", length_field=UBInt16("length"), encoding="utf8")
     self.assertEqual(s.build(six.u("hello")), six.b("\x00\x05hello"))
Esempio n. 2
0
 def test_build_custom_length_field(self):
     s = PascalString("foo",
                      length_field=UBInt16("length"),
                      encoding="utf8")
     self.assertEqual(s.build(six.u("hello")), six.b("\x00\x05hello"))
Esempio n. 3
0
 def test_build(self):
     s = PascalString("foo", encoding="utf8")
     self.assertEqual(s.build(six.u("hello world")), six.b("\x0bhello world"))
Esempio n. 4
0
 def test_build(self):
     s = PascalString("foo", encoding="utf8")
     self.assertEqual(s.build(six.u("hello world")),
                      six.b("\x0bhello world"))
Esempio n. 5
0
 def test_build_custom_length_field(self):
     s = PascalString("foo", length_field=UBInt16("length"))
     self.assertEqual(s.build(b"hello"), b"\x00\x05hello")
Esempio n. 6
0
 def test_build(self):
     s = PascalString("foo")
     self.assertEqual(s.build(b"hello world"), b"\x0bhello world")
Esempio n. 7
0
 def test_build_custom_length_field(self):
     s = PascalString("s", lengthfield=UBInt16(None), encoding="utf8")
     self.assertEqual(s.build(u"hello"), b"\x00\x05hello")
Esempio n. 8
0
 def test_build(self):
     s = PascalString("s", encoding="utf8")
     self.assertEqual(s.build(u"hello world"), b"\x0bhello world")
     s = PascalString("s")
     self.assertEqual(s.build(b"hello world"), b"\x0bhello world")