Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(86663)

Side by Side Diff: Lib/ctypes/test/test_parameters.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/ctypes/test/test_libc.py ('k') | Lib/ctypes/test/test_pickling.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import os
1 import unittest, sys 2 import unittest, sys
2 from ctypes.test import need_symbol 3 from ctypes.test import need_symbol
3 4
4 class SimpleTypesTestCase(unittest.TestCase): 5 class SimpleTypesTestCase(unittest.TestCase):
5 6
6 def setUp(self): 7 def setUp(self):
7 import ctypes 8 import ctypes
8 try: 9 try:
9 from _ctypes import set_conversion_mode 10 from _ctypes import set_conversion_mode
10 except ImportError: 11 except ImportError:
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 LPINT = POINTER(c_int) 133 LPINT = POINTER(c_int)
133 LPINT.from_param((c_int*3)()) 134 LPINT.from_param((c_int*3)())
134 self.assertRaises(TypeError, LPINT.from_param, c_short*3) 135 self.assertRaises(TypeError, LPINT.from_param, c_short*3)
135 self.assertRaises(TypeError, LPINT.from_param, c_long*3) 136 self.assertRaises(TypeError, LPINT.from_param, c_long*3)
136 self.assertRaises(TypeError, LPINT.from_param, c_uint*3) 137 self.assertRaises(TypeError, LPINT.from_param, c_uint*3)
137 138
138 def test_noctypes_argtype(self): 139 def test_noctypes_argtype(self):
139 import _ctypes_test 140 import _ctypes_test
140 from ctypes import CDLL, c_void_p, ArgumentError 141 from ctypes import CDLL, c_void_p, ArgumentError
141 142
142 func = CDLL(_ctypes_test.__file__)._testfunc_p_p 143 func = CDLL(getattr(_ctypes_test, '__file__', os.environ['TEST_EXECUTABL E']))._testfunc_p_p
143 func.restype = c_void_p 144 func.restype = c_void_p
144 # TypeError: has no from_param method 145 # TypeError: has no from_param method
145 self.assertRaises(TypeError, setattr, func, "argtypes", (object,)) 146 self.assertRaises(TypeError, setattr, func, "argtypes", (object,))
146 147
147 class Adapter(object): 148 class Adapter(object):
148 def from_param(cls, obj): 149 def from_param(cls, obj):
149 return None 150 return None
150 151
151 func.argtypes = (Adapter(),) 152 func.argtypes = (Adapter(),)
152 self.assertEqual(func(None), None) 153 self.assertEqual(func(None), None)
(...skipping 14 matching lines...) Expand all
167 168
168 func.argtypes = (Adapter(),) 169 func.argtypes = (Adapter(),)
169 # ArgumentError: argument 1: ValueError: 99 170 # ArgumentError: argument 1: ValueError: 99
170 self.assertRaises(ArgumentError, func, 99) 171 self.assertRaises(ArgumentError, func, 99)
171 172
172 173
173 ################################################################ 174 ################################################################
174 175
175 if __name__ == '__main__': 176 if __name__ == '__main__':
176 unittest.main() 177 unittest.main()
OLDNEW
« no previous file with comments | « Lib/ctypes/test/test_libc.py ('k') | Lib/ctypes/test/test_pickling.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+