Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
b39a5785
Commit
b39a5785
authored
May 05, 2020
by
Matti Picus
Committed by
GitHub
May 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test for ndarray attributes (GH-3521)
parent
22a49f40
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
tests/run/numpy_attributes.pyx
tests/run/numpy_attributes.pyx
+37
-0
No files found.
tests/run/numpy_attributes.pyx
0 → 100644
View file @
b39a5785
# mode: run
# tag: numpy
import
numpy
as
np
cimport
numpy
as
cnp
cnp
.
import_array
()
def
access_shape
():
"""
>>> access_shape()
10
"""
cdef
cnp
.
ndarray
[
double
,
ndim
=
2
,
mode
=
'c'
]
array_in
=
\
1e10
*
np
.
ones
((
10
,
10
))
return
array_in
.
shape
[
0
]
def
access_size
():
"""
>>> access_size()
100
"""
cdef
cnp
.
ndarray
[
double
,
ndim
=
2
,
mode
=
'c'
]
array_in
=
\
1e10
*
np
.
ones
((
10
,
10
))
return
array_in
.
size
def
access_strides
():
"""
>>> access_strides()
(80, 8)
"""
cdef
cnp
.
ndarray
[
double
,
ndim
=
2
,
mode
=
'c'
]
array_in
=
\
1e10
*
np
.
ones
((
10
,
10
),
dtype
=
np
.
float64
)
return
(
array_in
.
strides
[
0
],
array_in
.
strides
[
1
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment