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
Gwenaël Samain
cython
Commits
c0c68d8a
Commit
c0c68d8a
authored
Jan 17, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test broadcasting with object memoryviews
parent
ca91ec9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
1 deletion
+37
-1
tests/run/memslice.pyx
tests/run/memslice.pyx
+37
-1
No files found.
tests/run/memslice.pyx
View file @
c0c68d8a
...
...
@@ -1725,14 +1725,28 @@ def test_object_indices():
for
j
in
range
(
3
):
print
myslice
[
j
]
cdef
fused
slice_1d
:
object
int
[:]
cdef
fused
slice_2d
:
object
int
[:,
:]
@
testcase
def
test_ellipsis_expr
():
"""
>>> test_ellipsis_expr()
8
8
"""
cdef
int
[
10
]
a
cdef
int
[:]
m
=
a
_test_ellipsis_expr
(
m
)
_test_ellipsis_expr
(
<
object
>
m
)
cdef
_test_ellipsis_expr
(
slice_1d
m
):
m
[
4
]
=
8
m
[...]
=
m
[...]
print
m
[
4
]
...
...
@@ -1752,6 +1766,12 @@ def test_slice_assignment():
cdef
int
[:,
:]
m
=
carray
cdef
int
[:,
:]
copy
=
m
[
-
6
:
-
1
,
60
:
65
].
copy
()
_test_slice_assignment
(
m
,
copy
)
_test_slice_assignment
(
<
object
>
m
,
<
object
>
copy
)
cdef
_test_slice_assignment
(
slice_2d
m
,
slice_2d
copy
):
cdef
int
i
,
j
m
[...]
=
m
[::
-
1
,
::
-
1
]
m
[:,
:]
=
m
[::
-
1
,
::
-
1
]
m
[
-
5
:,
-
5
:]
=
m
[
-
6
:
-
1
,
60
:
65
]
...
...
@@ -1775,12 +1795,22 @@ def test_slice_assignment_broadcast_leading():
cdef
int
[:,
:]
a
=
array1
cdef
int
[:]
b
=
array2
_test_slice_assignment_broadcast_leading
(
a
,
b
)
for
i
in
range
(
10
):
array1
[
0
][
i
]
=
i
_test_slice_assignment_broadcast_leading
(
<
object
>
a
,
<
object
>
b
)
cdef
_test_slice_assignment_broadcast_leading
(
slice_2d
a
,
slice_1d
b
):
cdef
int
i
b
[:]
=
a
[:,
:]
b
=
b
[::
-
1
]
a
[:,
:]
=
b
[:]
for
i
in
range
(
10
):
assert
a
[
0
,
i
]
==
b
[
i
]
==
10
-
1
-
i
,
(
b
[
i
],
a
[
0
,
i
]
)
assert
a
[
0
,
i
]
==
b
[
i
]
==
10
-
1
-
i
,
(
a
[
0
,
i
],
b
[
i
],
10
-
1
-
i
)
@
testcase
def
test_slice_assignment_broadcast_strides
():
...
...
@@ -1798,6 +1828,12 @@ def test_slice_assignment_broadcast_strides():
cdef
int
[:,
:]
dst
=
dst_array
cdef
int
[:,
:]
dst_f
=
dst
.
copy_fortran
()
_test_slice_assignment_broadcast_strides
(
src
,
dst
,
dst_f
)
_test_slice_assignment_broadcast_strides
(
<
object
>
src
,
<
object
>
dst
,
<
object
>
dst_f
)
cdef
_test_slice_assignment_broadcast_strides
(
slice_1d
src
,
slice_2d
dst
,
slice_2d
dst_f
):
cdef
int
i
,
j
dst
[
1
:]
=
src
[
-
1
:
-
6
:
-
1
]
dst_f
[
1
:]
=
src
[
-
1
:
-
6
:
-
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