コード例 #1
0
ファイル: test_compat.py プロジェクト: hhco/txdarn
 def test_stringFromNetworkFails_py3(self):
     with self.assertRaises(TypeError):
         C.stringFromNetwork("i fail because i'm a native string")
コード例 #2
0
ファイル: test_compat.py プロジェクト: hhco/txdarn
    def test_stringFromNetworkFails_py2(self):
        with self.assertRaises(TypeError):
            C.stringFromNetwork(u"i fail because i'm unicode")

        with self.assertRaises(UnicodeDecodeError):
            C.stringFromNetwork("\xff fails because it's not ascii")
コード例 #3
0
ファイル: test_compat.py プロジェクト: hhco/txdarn
 def test_stringFromNetwork(self):
     self.assertEqual(C.stringFromNetwork(b'bytes to native string'),
                      'bytes to native string')