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

Side by Side Diff: Lib/ctypes/test/test_functions.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_funcptr.py ('k') | Lib/ctypes/test/test_libc.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 """ 1 """
2 Here is probably the place to write the docs, since the test-cases 2 Here is probably the place to write the docs, since the test-cases
3 show how the type behave. 3 show how the type behave.
4 4
5 Later... 5 Later...
6 """ 6 """
7 7
8 from ctypes import * 8 from ctypes import *
9 from ctypes.test import need_symbol 9 from ctypes.test import need_symbol
10 import os
10 import sys, unittest 11 import sys, unittest
11 12
12 try: 13 try:
13 WINFUNCTYPE 14 WINFUNCTYPE
14 except NameError: 15 except NameError:
15 # fake to enable this test on Linux 16 # fake to enable this test on Linux
16 WINFUNCTYPE = CFUNCTYPE 17 WINFUNCTYPE = CFUNCTYPE
17 18
18 import _ctypes_test 19 import _ctypes_test
19 dll = CDLL(_ctypes_test.__file__) 20 dll = CDLL(getattr(_ctypes_test, '__file__', os.environ['TEST_EXECUTABLE']))
20 if sys.platform == "win32": 21 if sys.platform == "win32":
21 windll = WinDLL(_ctypes_test.__file__) 22 windll = WinDLL(_ctypes_test.__file__)
22 23
23 class POINT(Structure): 24 class POINT(Structure):
24 _fields_ = [("x", c_int), ("y", c_int)] 25 _fields_ = [("x", c_int), ("y", c_int)]
25 class RECT(Structure): 26 class RECT(Structure):
26 _fields_ = [("left", c_int), ("top", c_int), 27 _fields_ = [("left", c_int), ("top", c_int),
27 ("right", c_int), ("bottom", c_int)] 28 ("right", c_int), ("bottom", c_int)]
28 class FunctionTestCase(unittest.TestCase): 29 class FunctionTestCase(unittest.TestCase):
29 30
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 394
394 proto = CFUNCTYPE(c_int, RECT, POINT) 395 proto = CFUNCTYPE(c_int, RECT, POINT)
395 def callback(*args): 396 def callback(*args):
396 return 0 397 return 0
397 398
398 callback = proto(callback) 399 callback = proto(callback)
399 self.assertRaises(ArgumentError, lambda: callback((1, 2, 3, 4), POINT()) ) 400 self.assertRaises(ArgumentError, lambda: callback((1, 2, 3, 4), POINT()) )
400 401
401 if __name__ == '__main__': 402 if __name__ == '__main__':
402 unittest.main() 403 unittest.main()
OLDNEW
« no previous file with comments | « Lib/ctypes/test/test_funcptr.py ('k') | Lib/ctypes/test/test_libc.py » ('j') | no next file with comments »

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