Beispiel #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"))
Beispiel #2
0
 def test_parse(self):
     s = String("foo", 5)
     self.assertEqual(s.parse(six.b("hello")), six.b("hello"))
Beispiel #3
0
 def test_parse(self):
     s = String("foo", 5)
     self.assertEqual(s.parse(six.b("hello")), six.b("hello"))
Beispiel #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"))
Beispiel #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"))
Beispiel #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"))
Beispiel #7
0
 def test_parse(self):
     s = String("foo", 5)
     self.assertEqual(s.parse(b"hello"), b"hello")
Beispiel #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")
Beispiel #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")
Beispiel #10
0
 def test_parse_padded(self):
     s = String("foo", 10, padchar=b"X", paddir="right")
     self.assertEqual(s.parse(b"helloXXXXX"), b"hello")
Beispiel #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")