Skip to content

Commit ce75474

Browse files
committed
DOC: examples [skip azp] [skip actions] [skip cirrus]
Add additional method test on ctype conversion
1 parent c83ee2e commit ce75474

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

numpy/ctypeslib.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,15 +571,19 @@ def as_ctypes(obj):
571571
572572
>>> inferred_int_array = np.array([1, 2, 3])
573573
>>> c_int_array = np.ctypeslib.as_ctypes(inferred_int_array)
574-
>>> c_int_array
575-
<c_long_Array_3 at 0x1071fbed0>
574+
>>> type(c_int_array)
575+
<class 'c_long_Array_3'>
576+
>>> c_int_array[:]
577+
[1, 2, 3]
576578
577579
Create ctypes object from explicit 8 bit unsigned int ``np.array`` :
578580
579581
>>> exp_int_array = np.array([1, 2, 3], dtype=np.uint8)
580582
>>> c_int_array = np.ctypeslib.as_ctypes(exp_int_array)
581-
>>> c_int_array
582-
<c_ubyte_Array_3 at 0x10755a950>
583+
>>> type(c_int_array)
584+
<class 'c_ubyte_Array_3'>
585+
>>> c_int_array[:]
586+
[1, 2, 3]
583587
584588
"""
585589
ai = obj.__array_interface__

0 commit comments

Comments
 (0)