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
178bda41
Commit
178bda41
authored
Aug 18, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
67e09ee7
1edd3d94
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
tests/run/bufaccess.pyx
tests/run/bufaccess.pyx
+2
-5
tests/run/tnumpy.pyx
tests/run/tnumpy.pyx
+11
-3
No files found.
tests/run/bufaccess.pyx
View file @
178bda41
...
@@ -81,7 +81,6 @@ def acquire_raise(o):
...
@@ -81,7 +81,6 @@ def acquire_raise(o):
>>> A.printlog()
>>> A.printlog()
acquired A
acquired A
released A
released A
<BLANKLINE>
"""
"""
cdef
object
[
int
]
buf
cdef
object
[
int
]
buf
...
@@ -443,7 +442,7 @@ def list_comprehension(object[int] buf, len):
...
@@ -443,7 +442,7 @@ def list_comprehension(object[int] buf, len):
1|2|3
1|2|3
"""
"""
cdef
int
i
cdef
int
i
print
"|"
.
join
([
str
(
buf
[
i
])
for
i
in
range
(
len
)])
print
u"|"
.
join
([
unicode
(
buf
[
i
])
for
i
in
range
(
len
)])
#
#
# Buffer type mismatch examples. Varying the type and access
# Buffer type mismatch examples. Varying the type and access
...
@@ -900,8 +899,6 @@ cdef class MockBuffer:
...
@@ -900,8 +899,6 @@ cdef class MockBuffer:
suboffsets
=
[
0
]
*
(
self
.
ndim
-
1
)
+
[
-
1
]
suboffsets
=
[
0
]
*
(
self
.
ndim
-
1
)
+
[
-
1
]
strides
=
[
sizeof
(
void
*
)]
*
(
self
.
ndim
-
1
)
+
[
self
.
itemsize
]
strides
=
[
sizeof
(
void
*
)]
*
(
self
.
ndim
-
1
)
+
[
self
.
itemsize
]
self
.
suboffsets
=
self
.
list_to_sizebuf
(
suboffsets
)
self
.
suboffsets
=
self
.
list_to_sizebuf
(
suboffsets
)
# printf("%ld; %ld %ld %ld %ld %ld", i0, s0, o0, i1, s1, o1);
else
:
else
:
# strided and/or simple access
# strided and/or simple access
self
.
buffer
=
self
.
create_buffer
(
data
)
self
.
buffer
=
self
.
create_buffer
(
data
)
...
@@ -987,7 +984,7 @@ cdef class MockBuffer:
...
@@ -987,7 +984,7 @@ cdef class MockBuffer:
self
.
log
+=
msg
+
"
\
n
"
self
.
log
+=
msg
+
"
\
n
"
def
printlog
(
self
):
def
printlog
(
self
):
print
self
.
log
print
self
.
log
[:
-
1
]
def
resetlog
(
self
):
def
resetlog
(
self
):
self
.
log
=
""
self
.
log
=
""
...
...
tests/run/tnumpy.pyx
View file @
178bda41
...
@@ -14,10 +14,10 @@ try:
...
@@ -14,10 +14,10 @@ try:
>>> three_dim()
>>> three_dim()
[[[ 0. 1. 2. 3.]
[[[ 0. 1. 2. 3.]
[ 4. 5. 6. 7.]]
[ 4. 5. 6. 7.]]
<
BLANKLINE
>
<
_BLANKLINE_
>
[[ 8. 9. 10. 11.]
[[ 8. 9. 10. 11.]
[ 12. 13. 14. 15.]]
[ 12. 13. 14. 15.]]
<
BLANKLINE
>
<
_BLANKLINE_
>
[[ 16. 17. 18. 19.]
[[ 16. 17. 18. 19.]
[ 20. 21. 22. 23.]]]
[ 20. 21. 22. 23.]]]
6.0 0.0 13.0 8.0
6.0 0.0 13.0 8.0
...
@@ -96,6 +96,7 @@ try:
...
@@ -96,6 +96,7 @@ try:
>>> test_dtype(np.long, inc1_long_t)
>>> test_dtype(np.long, inc1_long_t)
>>> test_dtype(np.float, inc1_float_t)
>>> test_dtype(np.float, inc1_float_t)
>>> test_dtype(np.double, inc1_double_t)
>>> test_dtype(np.double, inc1_double_t)
>>> test_dtype(np.longdouble, inc1_longdouble_t)
>>> test_dtype(np.longdouble, inc1_longdouble_t)
>>> test_dtype(np.int32, inc1_int32_t)
>>> test_dtype(np.int32, inc1_int32_t)
...
@@ -117,6 +118,13 @@ try:
...
@@ -117,6 +118,13 @@ try:
except
:
except
:
__doc__
=
""
__doc__
=
""
def
ndarray_str
(
arr
):
"""
Since Py2.3 doctest don't support <BLANKLINE>, manually replace blank lines
with <_BLANKLINE_>
"""
return
str
(
arr
).
replace
(
'
\
n
\
n
'
,
'
\
n
<_BLANKLINE_>
\
n
'
)
def
basic
():
def
basic
():
cdef
object
[
int
,
ndim
=
2
]
buf
=
np
.
arange
(
10
,
dtype
=
'i'
).
reshape
((
2
,
5
))
cdef
object
[
int
,
ndim
=
2
]
buf
=
np
.
arange
(
10
,
dtype
=
'i'
).
reshape
((
2
,
5
))
print
buf
print
buf
...
@@ -124,7 +132,7 @@ def basic():
...
@@ -124,7 +132,7 @@ def basic():
def
three_dim
():
def
three_dim
():
cdef
object
[
double
,
ndim
=
3
]
buf
=
np
.
arange
(
24
,
dtype
=
'd'
).
reshape
((
3
,
2
,
4
))
cdef
object
[
double
,
ndim
=
3
]
buf
=
np
.
arange
(
24
,
dtype
=
'd'
).
reshape
((
3
,
2
,
4
))
print
buf
print
ndarray_str
(
buf
)
print
buf
[
0
,
1
,
2
],
buf
[
0
,
0
,
0
],
buf
[
1
,
1
,
1
],
buf
[
1
,
0
,
0
]
print
buf
[
0
,
1
,
2
],
buf
[
0
,
0
,
0
],
buf
[
1
,
1
,
1
],
buf
[
1
,
0
,
0
]
def
obj_array
():
def
obj_array
():
...
...
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