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
5612dcc5
Commit
5612dcc5
authored
Feb 23, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert offending NumPy test changes
parent
649231ea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
tests/run/numpy_test.pyx
tests/run/numpy_test.pyx
+9
-9
No files found.
tests/run/numpy_test.pyx
View file @
5612dcc5
...
@@ -165,17 +165,17 @@ def ndarray_str(arr):
...
@@ -165,17 +165,17 @@ def ndarray_str(arr):
return
unicode
(
arr
).
replace
(
u'
\
n
\
n
'
,
u'
\
n
<_BLANKLINE_>
\
n
'
)
return
unicode
(
arr
).
replace
(
u'
\
n
\
n
'
,
u'
\
n
<_BLANKLINE_>
\
n
'
)
def
basic
():
def
basic
():
cdef
object
[
int
,
ndim
=
2
]
buf
=
np
.
arange
(
10
,
dtype
=
u
'i'
).
reshape
((
2
,
5
))
cdef
object
[
int
,
ndim
=
2
]
buf
=
np
.
arange
(
10
,
dtype
=
b
'i'
).
reshape
((
2
,
5
))
print
buf
print
buf
print
buf
[
0
,
2
],
buf
[
0
,
0
],
buf
[
1
,
4
],
buf
[
1
,
0
]
print
buf
[
0
,
2
],
buf
[
0
,
0
],
buf
[
1
,
4
],
buf
[
1
,
0
]
def
three_dim
():
def
three_dim
():
cdef
object
[
double
,
ndim
=
3
]
buf
=
np
.
arange
(
24
,
dtype
=
u
'd'
).
reshape
((
3
,
2
,
4
))
cdef
object
[
double
,
ndim
=
3
]
buf
=
np
.
arange
(
24
,
dtype
=
b
'd'
).
reshape
((
3
,
2
,
4
))
print
ndarray_str
(
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
():
cdef
object
[
object
,
ndim
=
1
]
buf
=
np
.
array
([
u
"a"
,
1
,
{}])
cdef
object
[
object
,
ndim
=
1
]
buf
=
np
.
array
([
b
"a"
,
1
,
{}])
print
buf
print
buf
print
buf
[
0
],
buf
[
1
],
buf
[
2
]
print
buf
[
0
],
buf
[
1
],
buf
[
2
]
...
@@ -192,12 +192,12 @@ def put_range_long_1d(np.ndarray[long] arr):
...
@@ -192,12 +192,12 @@ def put_range_long_1d(np.ndarray[long] arr):
arr
[
i
]
=
value
arr
[
i
]
=
value
value
+=
1
value
+=
1
def
test_c_contig
(
np
.
ndarray
[
int
,
ndim
=
2
,
mode
=
u
'c'
]
arr
):
def
test_c_contig
(
np
.
ndarray
[
int
,
ndim
=
2
,
mode
=
b
'c'
]
arr
):
cdef
int
i
,
j
cdef
int
i
,
j
for
i
in
range
(
arr
.
shape
[
0
]):
for
i
in
range
(
arr
.
shape
[
0
]):
print
u" "
.
join
([
unicode
(
arr
[
i
,
j
])
for
j
in
range
(
arr
.
shape
[
1
])])
print
u" "
.
join
([
unicode
(
arr
[
i
,
j
])
for
j
in
range
(
arr
.
shape
[
1
])])
def
test_f_contig
(
np
.
ndarray
[
int
,
ndim
=
2
,
mode
=
u
'fortran'
]
arr
):
def
test_f_contig
(
np
.
ndarray
[
int
,
ndim
=
2
,
mode
=
b
'fortran'
]
arr
):
cdef
int
i
,
j
cdef
int
i
,
j
for
i
in
range
(
arr
.
shape
[
0
]):
for
i
in
range
(
arr
.
shape
[
0
]):
print
u" "
.
join
([
unicode
(
arr
[
i
,
j
])
for
j
in
range
(
arr
.
shape
[
1
])])
print
u" "
.
join
([
unicode
(
arr
[
i
,
j
])
for
j
in
range
(
arr
.
shape
[
1
])])
...
@@ -250,7 +250,7 @@ def inc1_float64_t(np.ndarray[np.float64_t] arr): arr[1] += 1
...
@@ -250,7 +250,7 @@ def inc1_float64_t(np.ndarray[np.float64_t] arr): arr[1] += 1
def
test_dtype
(
dtype
,
inc1
):
def
test_dtype
(
dtype
,
inc1
):
if
dtype
in
(
u'F'
,
u'D'
,
u
'G'
):
if
dtype
in
(
b'F'
,
b'D'
,
b
'G'
):
a
=
np
.
array
([
0
,
10
+
10j
],
dtype
=
dtype
)
a
=
np
.
array
([
0
,
10
+
10j
],
dtype
=
dtype
)
inc1
(
a
)
inc1
(
a
)
if
a
[
1
]
!=
(
11
+
11j
):
print
u"failed!"
,
a
[
1
]
if
a
[
1
]
!=
(
11
+
11j
):
print
u"failed!"
,
a
[
1
]
...
@@ -264,7 +264,7 @@ cdef struct DoubleInt:
...
@@ -264,7 +264,7 @@ cdef struct DoubleInt:
def
test_recordarray
():
def
test_recordarray
():
cdef
object
[
DoubleInt
]
arr
cdef
object
[
DoubleInt
]
arr
arr
=
np
.
array
([(
5
,
5
),
(
4
,
6
)],
dtype
=
np
.
dtype
(
u
'i,i'
))
arr
=
np
.
array
([(
5
,
5
),
(
4
,
6
)],
dtype
=
np
.
dtype
(
b
'i,i'
))
cdef
DoubleInt
rec
cdef
DoubleInt
rec
rec
=
arr
[
0
]
rec
=
arr
[
0
]
if
rec
.
x
!=
5
:
print
u"failed"
if
rec
.
x
!=
5
:
print
u"failed"
...
@@ -304,10 +304,10 @@ def test_bad_nested_dtypes():
...
@@ -304,10 +304,10 @@ def test_bad_nested_dtypes():
def
test_good_cast
():
def
test_good_cast
():
# Check that a signed int can round-trip through casted unsigned int access
# Check that a signed int can round-trip through casted unsigned int access
cdef
np
.
ndarray
[
unsigned
int
,
cast
=
True
]
arr
=
np
.
array
([
-
100
],
dtype
=
u
'i'
)
cdef
np
.
ndarray
[
unsigned
int
,
cast
=
True
]
arr
=
np
.
array
([
-
100
],
dtype
=
b
'i'
)
cdef
unsigned
int
data
=
arr
[
0
]
cdef
unsigned
int
data
=
arr
[
0
]
return
-
100
==
<
int
>
data
return
-
100
==
<
int
>
data
def
test_bad_cast
():
def
test_bad_cast
():
# This should raise an exception
# This should raise an exception
cdef
np
.
ndarray
[
long
,
cast
=
True
]
arr
=
np
.
array
([
1
],
dtype
=
u
'b'
)
cdef
np
.
ndarray
[
long
,
cast
=
True
]
arr
=
np
.
array
([
1
],
dtype
=
b
'b'
)
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