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

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

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 9 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_slicing.py ('k') | Lib/ctypes/test/test_unicode.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 2 import unittest
2 from test import support 3 from test import support
3 from ctypes import * 4 from ctypes import *
4 5
5 import _ctypes_test 6 import _ctypes_test
6 7
7 lib = CDLL(_ctypes_test.__file__) 8 lib = CDLL(getattr(_ctypes_test, '__file__', os.environ['TEST_EXECUTABLE']))
8 9
9 class StringPtrTestCase(unittest.TestCase): 10 class StringPtrTestCase(unittest.TestCase):
10 11
11 @support.refcount_test 12 @support.refcount_test
12 def test__POINTER_c_char(self): 13 def test__POINTER_c_char(self):
13 class X(Structure): 14 class X(Structure):
14 _fields_ = [("str", POINTER(c_char))] 15 _fields_ = [("str", POINTER(c_char))]
15 x = X() 16 x = X()
16 17
17 # NULL pointer access 18 # NULL pointer access
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 buf = c_buffer(b"abcdef") 69 buf = c_buffer(b"abcdef")
69 r = strchr(buf, b"c") 70 r = strchr(buf, b"c")
70 x = r[0], r[1], r[2], r[3], r[4] 71 x = r[0], r[1], r[2], r[3], r[4]
71 self.assertEqual(x, (b"c", b"d", b"e", b"f", b"\000")) 72 self.assertEqual(x, (b"c", b"d", b"e", b"f", b"\000"))
72 del buf 73 del buf
73 # x1 will NOT be the same as x, usually: 74 # x1 will NOT be the same as x, usually:
74 x1 = r[0], r[1], r[2], r[3], r[4] 75 x1 = r[0], r[1], r[2], r[3], r[4]
75 76
76 if __name__ == '__main__': 77 if __name__ == '__main__':
77 unittest.main() 78 unittest.main()
OLDNEW
« no previous file with comments | « Lib/ctypes/test/test_slicing.py ('k') | Lib/ctypes/test/test_unicode.py » ('j') | no next file with comments »

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