summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-08-25 17:02:22 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-08-25 17:02:22 (GMT)
commitb35f64679615c3c167fb0d4ee04293dbff17c5e9 (patch)
tree21b4bf5d8174f1acb42a0b040ad50568e6e33d0f
parentef6ff662c933f43df5bba40032de2d718f4e1fd8 (diff)
downloadcpython-b35f64679615c3c167fb0d4ee04293dbff17c5e9.zip
cpython-b35f64679615c3c167fb0d4ee04293dbff17c5e9.tar.gz
cpython-b35f64679615c3c167fb0d4ee04293dbff17c5e9.tar.bz2
this test is only valid when sizeof(wchar) == Py_UNICODE_SIZE
-rw-r--r--Lib/ctypes/test/test_parameters.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py
index e83fd9a..391c4ea 100644
--- a/Lib/ctypes/test/test_parameters.py
+++ b/Lib/ctypes/test/test_parameters.py
@@ -67,15 +67,17 @@ class SimpleTypesTestCase(unittest.TestCase):
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