Esempio n. 1
0
 def test_contents_equals_input(self):
     text = text_type(self.random_string(6))
     output = _text_to_wchar(text)
     ffi, _ = dist.load()
     self.assertEqual(ffi.string(output), text)
Esempio n. 2
0
 def test_conversion_output_type(self):
     text = text_type(self.random_string(6))
     output = _text_to_wchar(text)
     ffi, _ = dist.load()
     typeof = ffi.typeof(output)
     self.assertEqual(typeof.cname, "wchar_t[%d]" % len(text))
Esempio n. 3
0
 def test_input_type_check(self):
     bad_input = "hello, world" if PY2 else b"hello, world"
     with self.assertRaises(InputError):
         _text_to_wchar(bad_input)
Esempio n. 4
0
 def test_contents_equals_input(self):
     text = text_type(self.random_string(6))
     output = _text_to_wchar(text)
     ffi, _ = dist.load()
     self.assertEqual(ffi.string(output), text)
Esempio n. 5
0
 def test_conversion_output_type(self):
     text = text_type(self.random_string(6))
     output = _text_to_wchar(text)
     ffi, _ = dist.load()
     typeof = ffi.typeof(output)
     self.assertEqual(typeof.cname, "wchar_t[{0}]".format(len(text)))
Esempio n. 6
0
 def test_input_type_check(self):
     bad_input = b"hello, world"
     with self.assertRaises(InputError):
         _text_to_wchar(bad_input)