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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
0e610318
Commit
0e610318
authored
Oct 30, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move a numpy+memoryview test to a better place where it doesn't require all the setup+run overhead.
parent
187d3491
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
18 deletions
+19
-18
tests/memoryview/gh2588.pyx
tests/memoryview/gh2588.pyx
+0
-18
tests/memoryview/numpy_memoryview.pyx
tests/memoryview/numpy_memoryview.pyx
+19
-0
No files found.
tests/memoryview/gh2588.pyx
deleted
100644 → 0
View file @
187d3491
# mode: run
cimport
cython
@
cython
.
boundscheck
(
False
)
@
cython
.
wraparound
(
False
)
def
testing_memoryview
(
double
[:,
:]
x
):
""" Function testing boundscheck and wraparound in memoryview
>>> import numpy as np
>>> array = np.ones((2,2)) * 3.5
>>> testing_memoryview(array)
"""
cdef
Py_ssize_t
numrow
=
x
.
shape
[
0
]
cdef
Py_ssize_t
i
for
i
in
range
(
numrow
):
x
[
i
,
0
]
x
[
i
]
x
[
i
,
...]
x
[
i
,
:]
tests/memoryview/numpy_memoryview.pyx
View file @
0e610318
...
...
@@ -370,6 +370,7 @@ def test_coerce_to_numpy():
ints
[
idx
]
=
222
longlongs
[
idx
]
=
333
externs
[
idx
]
=
444
assert
externs
[
idx
]
==
444
# avoid "set but not used" C compiler warning
floats
[
idx
]
=
11.1
doubles
[
idx
]
=
12.2
...
...
@@ -699,3 +700,21 @@ def test_refcount_GH507():
a
=
np
.
arange
(
12
).
reshape
([
3
,
4
])
cdef
np
.
int_t
[:,:]
a_view
=
a
cdef
np
.
int_t
[:,:]
b
=
a_view
[
1
:
2
,:].
T
@
cython
.
boundscheck
(
False
)
@
cython
.
wraparound
(
False
)
def
test_boundscheck_and_wraparound
(
double
[:,
:]
x
):
"""
>>> import numpy as np
>>> array = np.ones((2,2)) * 3.5
>>> testing_memoryview(array)
"""
# Make sure we don't generate C compiler warnings for unused code here.
cdef
Py_ssize_t
numrow
=
x
.
shape
[
0
]
cdef
Py_ssize_t
i
for
i
in
range
(
numrow
):
x
[
i
,
0
]
x
[
i
]
x
[
i
,
...]
x
[
i
,
:]
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