Exemple #1
0
 def test_networkStringFails_py3(self):
     with self.assertRaises(TypeError):
         C.networkString(b"i fail because i'm bytes")
Exemple #2
0
    def test_networkStringFails_py2(self):
        with self.assertRaises(TypeError):
            C.networkString(u"i fail because i'm unicode")

        with self.assertRaises(UnicodeDecodeError):
            C.networkString(b"\xff fails because it's not ascii")
Exemple #3
0
 def test_networkString(self):
     self.assertEqual(C.networkString('native string to bytes'),
                      b'native string to bytes')