Fix tests when ctypes isn't available

This commit is contained in:
Antoine Pitrou 2010-11-22 16:19:04 +00:00
parent 2baf1a69f4
commit 0662bc297a

View file

@ -1439,6 +1439,7 @@ class UnicodeTest(string_tests.CommonTest,
# Test PyUnicode_AsWideChar() # Test PyUnicode_AsWideChar()
def test_aswidechar(self): def test_aswidechar(self):
from _testcapi import unicode_aswidechar from _testcapi import unicode_aswidechar
support.import_module('ctypes')
from ctypes import c_wchar, sizeof from ctypes import c_wchar, sizeof
wchar, size = unicode_aswidechar('abcdef', 2) wchar, size = unicode_aswidechar('abcdef', 2)
@ -1475,6 +1476,7 @@ class UnicodeTest(string_tests.CommonTest,
# Test PyUnicode_AsWideCharString() # Test PyUnicode_AsWideCharString()
def test_aswidecharstring(self): def test_aswidecharstring(self):
from _testcapi import unicode_aswidecharstring from _testcapi import unicode_aswidecharstring
support.import_module('ctypes')
from ctypes import c_wchar, sizeof from ctypes import c_wchar, sizeof
wchar, size = unicode_aswidecharstring('abc') wchar, size = unicode_aswidecharstring('abc')