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

Side by Side Diff: Lib/ctypes/test/test_cfuncs.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_callbacks.py ('k') | Lib/ctypes/test/test_checkretval.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 # A lot of failures in these tests on Mac OS X. 1 # A lot of failures in these tests on Mac OS X.
2 # Byte order related? 2 # Byte order related?
3 3
4 import os
4 import unittest 5 import unittest
5 from ctypes import * 6 from ctypes import *
6 from ctypes.test import need_symbol 7 from ctypes.test import need_symbol
7 8
8 import _ctypes_test 9 import _ctypes_test
9 10
10 class CFunctions(unittest.TestCase): 11 class CFunctions(unittest.TestCase):
11 _dll = CDLL(_ctypes_test.__file__) 12 _dll = CDLL(getattr(_ctypes_test, '__file__', os.environ['TEST_EXECUTABLE']) )
12 13
13 def S(self): 14 def S(self):
14 return c_longlong.in_dll(self._dll, "last_tf_arg_s").value 15 return c_longlong.in_dll(self._dll, "last_tf_arg_s").value
15 def U(self): 16 def U(self):
16 return c_ulonglong.in_dll(self._dll, "last_tf_arg_u").value 17 return c_ulonglong.in_dll(self._dll, "last_tf_arg_u").value
17 18
18 def test_byte(self): 19 def test_byte(self):
19 self._dll.tf_b.restype = c_byte 20 self._dll.tf_b.restype = c_byte
20 self._dll.tf_b.argtypes = (c_byte,) 21 self._dll.tf_b.argtypes = (c_byte,)
21 self.assertEqual(self._dll.tf_b(-126), -42) 22 self.assertEqual(self._dll.tf_b(-126), -42)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 class stdcall_dll(WinDLL): 200 class stdcall_dll(WinDLL):
200 def __getattr__(self, name): 201 def __getattr__(self, name):
201 if name[:2] == '__' and name[-2:] == '__': 202 if name[:2] == '__' and name[-2:] == '__':
202 raise AttributeError(name) 203 raise AttributeError(name)
203 func = self._FuncPtr(("s_" + name, self)) 204 func = self._FuncPtr(("s_" + name, self))
204 setattr(self, name, func) 205 setattr(self, name, func)
205 return func 206 return func
206 207
207 @need_symbol('WinDLL') 208 @need_symbol('WinDLL')
208 class stdcallCFunctions(CFunctions): 209 class stdcallCFunctions(CFunctions):
209 _dll = stdcall_dll(_ctypes_test.__file__) 210 _dll = stdcall_dll(getattr(_ctypes_test, '__file__', os.environ['TEST_EXECUT ABLE']))
210 211
211 if __name__ == '__main__': 212 if __name__ == '__main__':
212 unittest.main() 213 unittest.main()
OLDNEW
« no previous file with comments | « Lib/ctypes/test/test_callbacks.py ('k') | Lib/ctypes/test/test_checkretval.py » ('j') | no next file with comments »

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