Ejemplo n.º 1
0
 def test_parse_padded_center(self):
     s = String("foo", 10, padchar=six.b("X"), paddir="center")
     self.assertEqual(s.parse(six.b("XXhelloXXX")), six.b("hello"))
Ejemplo n.º 2
0
 def test_parse(self):
     s = String("foo", 5)
     self.assertEqual(s.parse(six.b("hello")), six.b("hello"))
Ejemplo n.º 3
0
 def test_parse(self):
     s = String("foo", 5)
     self.assertEqual(s.parse(six.b("hello")), six.b("hello"))
Ejemplo n.º 4
0
 def test_parse_utf8(self):
     s = String("foo", 12, encoding="utf8")
     self.assertEqual(s.parse(six.b("hello joh\xd4\x83n")), six.u("hello joh\u0503n"))
Ejemplo n.º 5
0
 def test_parse_utf8(self):
     s = String("foo", 12, encoding="utf8")
     self.assertEqual(s.parse(six.b("hello joh\xd4\x83n")),
                      six.u("hello joh\u0503n"))
Ejemplo n.º 6
0
 def test_parse_padded_center(self):
     s = String("foo", 10, padchar=six.b("X"), paddir="center")
     self.assertEqual(s.parse(six.b("XXhelloXXX")), six.b("hello"))
Ejemplo n.º 7
0
 def test_parse(self):
     s = String("foo", 5)
     self.assertEqual(s.parse(b"hello"), b"hello")
Ejemplo n.º 8
0
 def test_parse_padded_center(self):
     s = String("foo", 10, padchar=b"X", paddir="center")
     self.assertEqual(s.parse(b"XXhelloXXX"), b"hello")
Ejemplo n.º 9
0
 def test_parse_padded_left(self):
     s = String("foo", 10, padchar=b"X", paddir="left")
     self.assertEqual(s.parse(b"XXXXXhello"), b"hello")
Ejemplo n.º 10
0
 def test_parse_padded(self):
     s = String("foo", 10, padchar=b"X", paddir="right")
     self.assertEqual(s.parse(b"helloXXXXX"), b"hello")
Ejemplo n.º 11
0
 def test_parse_utf8(self):
     s = String("s", 12, encoding="utf8")
     self.assertEqual(s.parse(b"hello joh\xd4\x83n"), u"hello joh\u0503n")