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
6bcc8fd8
Commit
6bcc8fd8
authored
Aug 10, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests due to buffer char format change.
parent
b0539cbc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
15 deletions
+15
-15
tests/buffers/bufaccess.pyx
tests/buffers/bufaccess.pyx
+1
-1
tests/buffers/buffmt.pyx
tests/buffers/buffmt.pyx
+9
-9
tests/buffers/mockbuffers.pxi
tests/buffers/mockbuffers.pxi
+1
-1
tests/memoryview/memoryview.pyx
tests/memoryview/memoryview.pyx
+1
-1
tests/memoryview/memoryviewattrs.pyx
tests/memoryview/memoryviewattrs.pyx
+2
-2
tests/memoryview/memslice.pyx
tests/memoryview/memslice.pyx
+1
-1
No files found.
tests/buffers/bufaccess.pyx
View file @
6bcc8fd8
...
@@ -1034,7 +1034,7 @@ def basic_struct(object[MyStruct] buf):
...
@@ -1034,7 +1034,7 @@ def basic_struct(object[MyStruct] buf):
>>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)]))
>>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)]))
1 2 3 4 5
1 2 3 4 5
>>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)], format="
bb
qii"))
>>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)], format="
cc
qii"))
1 2 3 4 5
1 2 3 4 5
"""
"""
print
buf
[
0
].
a
,
buf
[
0
].
b
,
buf
[
0
].
c
,
buf
[
0
].
d
,
buf
[
0
].
e
print
buf
[
0
].
a
,
buf
[
0
].
b
,
buf
[
0
].
c
,
buf
[
0
].
d
,
buf
[
0
].
e
...
...
tests/buffers/buffmt.pyx
View file @
6bcc8fd8
...
@@ -63,7 +63,7 @@ def _int(fmt):
...
@@ -63,7 +63,7 @@ def _int(fmt):
>>> _int("b")
>>> _int("b")
Traceback (most recent call last):
Traceback (most recent call last):
...
...
ValueError: Buffer dtype mismatch, expected 'int' but got 'char'
ValueError: Buffer dtype mismatch, expected 'int' but got '
signed
char'
>>> _int("if")
>>> _int("if")
Traceback (most recent call last):
Traceback (most recent call last):
...
@@ -184,13 +184,13 @@ def char3int(fmt):
...
@@ -184,13 +184,13 @@ def char3int(fmt):
def
unpacked_struct
(
fmt
):
def
unpacked_struct
(
fmt
):
"""
"""
Native formats:
Native formats:
>>> unpacked_struct("
biZffb
iii")
>>> unpacked_struct("
ciZffc
iii")
>>> unpacked_struct("@
bi3fb
3i")
>>> unpacked_struct("@
ci3fc
3i")
>>> unpacked_struct("@
biZffb
i2i")
>>> unpacked_struct("@
ciZffc
i2i")
>>> unpacked_struct("
biZffT{b
iii}")
>>> unpacked_struct("
ciZffT{c
iii}")
>>> unpacked_struct("
bT{ifffb
2i}i")
>>> unpacked_struct("
cT{ifffc
2i}i")
>>> unpacked_struct("
biZffb
3T{i}")
>>> unpacked_struct("
ciZffc
3T{i}")
>>> unpacked_struct("T{
b}T{T{iZffT{b
i}}}2T{T{i}}")
>>> unpacked_struct("T{
c}T{T{iZffT{c
i}}}2T{T{i}}")
"""
"""
assert
(
sizeof
(
UnpackedStruct1
)
==
sizeof
(
UnpackedStruct2
)
assert
(
sizeof
(
UnpackedStruct1
)
==
sizeof
(
UnpackedStruct2
)
...
@@ -303,7 +303,7 @@ def packed_struct(fmt):
...
@@ -303,7 +303,7 @@ def packed_struct(fmt):
Assuming int is four bytes:
Assuming int is four bytes:
>>> packed_struct("^cici")
>>> packed_struct("^cici")
>>> packed_struct("=ci
b
i")
>>> packed_struct("=ci
c
i")
However aligned access won't work:
However aligned access won't work:
...
...
tests/buffers/mockbuffers.pxi
View file @
6bcc8fd8
...
@@ -280,7 +280,7 @@ cdef class MyStructMockBuffer(MockBuffer):
...
@@ -280,7 +280,7 @@ cdef class MyStructMockBuffer(MockBuffer):
return
0
return
0
cdef
get_itemsize
(
self
):
return
sizeof
(
MyStruct
)
cdef
get_itemsize
(
self
):
return
sizeof
(
MyStruct
)
cdef
get_default_format
(
self
):
return
b"2
b
q2i"
cdef
get_default_format
(
self
):
return
b"2
c
q2i"
cdef
class
NestedStructMockBuffer
(
MockBuffer
):
cdef
class
NestedStructMockBuffer
(
MockBuffer
):
cdef
int
write
(
self
,
char
*
buf
,
object
value
)
except
-
1
:
cdef
int
write
(
self
,
char
*
buf
,
object
value
)
except
-
1
:
...
...
tests/memoryview/memoryview.pyx
View file @
6bcc8fd8
...
@@ -237,7 +237,7 @@ def basic_struct(MyStruct[:] mslice):
...
@@ -237,7 +237,7 @@ def basic_struct(MyStruct[:] mslice):
>>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)]))
>>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)]))
[('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5)]
[('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5)]
>>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)], format="
bb
qii"))
>>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)], format="
cc
qii"))
[('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5)]
[('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5)]
"""
"""
buf
=
mslice
buf
=
mslice
...
...
tests/memoryview/memoryviewattrs.pyx
View file @
6bcc8fd8
...
@@ -30,13 +30,13 @@ def test_shape_stride_suboffset():
...
@@ -30,13 +30,13 @@ def test_shape_stride_suboffset():
77 11 1
77 11 1
-1 -1 -1
-1 -1 -1
'''
'''
cdef
char
[:,:,:]
larr
=
array
((
5
,
7
,
11
),
1
,
'
b
'
)
cdef
char
[:,:,:]
larr
=
array
((
5
,
7
,
11
),
1
,
'
c
'
)
print
larr
.
shape
[
0
],
larr
.
shape
[
1
],
larr
.
shape
[
2
]
print
larr
.
shape
[
0
],
larr
.
shape
[
1
],
larr
.
shape
[
2
]
print
larr
.
strides
[
0
],
larr
.
strides
[
1
],
larr
.
strides
[
2
]
print
larr
.
strides
[
0
],
larr
.
strides
[
1
],
larr
.
strides
[
2
]
print
larr
.
suboffsets
[
0
],
larr
.
suboffsets
[
1
],
larr
.
suboffsets
[
2
]
print
larr
.
suboffsets
[
0
],
larr
.
suboffsets
[
1
],
larr
.
suboffsets
[
2
]
print
print
larr
=
array
((
5
,
7
,
11
),
1
,
'
b
'
,
mode
=
'fortran'
)
larr
=
array
((
5
,
7
,
11
),
1
,
'
c
'
,
mode
=
'fortran'
)
print
larr
.
shape
[
0
],
larr
.
shape
[
1
],
larr
.
shape
[
2
]
print
larr
.
shape
[
0
],
larr
.
shape
[
1
],
larr
.
shape
[
2
]
print
larr
.
strides
[
0
],
larr
.
strides
[
1
],
larr
.
strides
[
2
]
print
larr
.
strides
[
0
],
larr
.
strides
[
1
],
larr
.
strides
[
2
]
print
larr
.
suboffsets
[
0
],
larr
.
suboffsets
[
1
],
larr
.
suboffsets
[
2
]
print
larr
.
suboffsets
[
0
],
larr
.
suboffsets
[
1
],
larr
.
suboffsets
[
2
]
...
...
tests/memoryview/memslice.pyx
View file @
6bcc8fd8
...
@@ -1008,7 +1008,7 @@ def basic_struct(MyStruct[:] buf):
...
@@ -1008,7 +1008,7 @@ def basic_struct(MyStruct[:] buf):
>>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)]))
>>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)]))
1 2 3 4 5
1 2 3 4 5
>>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)], format="
bb
qii"))
>>> basic_struct(MyStructMockBuffer(None, [(1, 2, 3, 4, 5)], format="
cc
qii"))
1 2 3 4 5
1 2 3 4 5
"""
"""
print
buf
[
0
].
a
,
buf
[
0
].
b
,
buf
[
0
].
c
,
buf
[
0
].
d
,
buf
[
0
].
e
print
buf
[
0
].
a
,
buf
[
0
].
b
,
buf
[
0
].
c
,
buf
[
0
].
d
,
buf
[
0
].
e
...
...
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