[Python-checkins] r84315 - python/branches/py3k/Lib/ctypes/test/test_parameters.py
benjamin.peterson
python-checkins at python.org
Wed Aug 25 19:02:22 CEST 2010
Author: benjamin.peterson
Date: Wed Aug 25 19:02:22 2010
New Revision: 84315
Log:
this test is only valid when sizeof(wchar) == Py_UNICODE_SIZE
Modified:
python/branches/py3k/Lib/ctypes/test/test_parameters.py
Modified: python/branches/py3k/Lib/ctypes/test/test_parameters.py
==============================================================================
--- python/branches/py3k/Lib/ctypes/test/test_parameters.py (original)
+++ python/branches/py3k/Lib/ctypes/test/test_parameters.py Wed Aug 25 19:02:22 2010
@@ -67,15 +67,17 @@
self.assertTrue(c_char_p.from_param(a) is a)
def test_cw_strings(self):
- from ctypes import byref
+ from ctypes import byref, sizeof
try:
- from ctypes import c_wchar_p
+ from ctypes import c_wchar, c_wchar_p
except ImportError:
## print "(No c_wchar_p)"
return
s = "123"
if sys.platform == "win32":
- self.assertTrue(c_wchar_p.from_param(s)._obj is s)
+ unisize = 8 if sys.maxunicode == 1114111 else 4
+ if unisize == sizeof(c_wchar):
+ self.assertIs(c_wchar_p.from_param(s)._obj, s)
self.assertRaises(TypeError, c_wchar_p.from_param, 42)
# new in 0.9.1: convert (decode) ascii to unicode
More information about the Python-checkins
mailing list