def test_networkStringFails_py3(self): with self.assertRaises(TypeError): C.networkString(b"i fail because i'm bytes")
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")
def test_networkString(self): self.assertEqual(C.networkString('native string to bytes'), b'native string to bytes')