Skip to content

Commit 87f8cf3

Browse files
Fix tests
1 parent a2cff24 commit 87f8cf3

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

Lib/test/test_ctypes/test_pointers.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,15 @@ def test_basics(self):
127127
def test_from_address(self):
128128
a = array.array('i', [100, 200, 300, 400, 500])
129129
addr = a.buffer_info()[0]
130+
p = POINTER(POINTER(c_int))
131+
132+
def test_pointer_from_pointer(self):
130133
p1 = POINTER(c_int)
131134
p2 = POINTER(p1)
132135

133136
self.assertIsNot(p1, p2)
137+
self.assertIs(p1.__pointer_type__, p2)
138+
self.assertIs(p2._type_, p1)
134139

135140
def test_other(self):
136141
class Table(Structure):
@@ -228,12 +233,13 @@ def test_pointer_types_equal(self):
228233
self.assertIs(t1, t2)
229234

230235
p1 = t1(c_int(1))
231-
p2 = t2(c_int(1))
232-
p3 = pointer(c_int(1))
236+
p2 = pointer(c_int(1))
233237

234238
self.assertIsInstance(p1, t1)
235239
self.assertIsInstance(p2, t1)
236-
self.assertIsInstance(p3, t1)
240+
241+
self.assertIs(type(p1), t1)
242+
self.assertIs(type(p2), t1)
237243

238244
def test_incomplete_pointer_types_not_equal(self):
239245
t1 = POINTER("LP_C")
@@ -246,10 +252,6 @@ def test_incomplete_pointer_types_cannot_instantiate(self):
246252
with self.assertRaisesRegex(TypeError, "has no _type_"):
247253
t1()
248254

249-
msg = "<class 'str'> must have storage info"
250-
with self.assertRaisesRegex(TypeError, msg):
251-
pointer("LP_C")
252-
253255
def test_pointer_set_type_twice(self):
254256
t1 = POINTER(c_int)
255257
self.assertIs(c_int.__pointer_type__, t1)

0 commit comments

Comments
 (0)