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
Boxiang Sun
cython
Commits
08c21802
Commit
08c21802
authored
Jul 07, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test in Py3
parent
a41131cf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
tests/run/charptr_from_temp.pyx
tests/run/charptr_from_temp.pyx
+10
-7
No files found.
tests/run/charptr_from_temp.pyx
View file @
08c21802
...
...
@@ -2,8 +2,11 @@
from
cpython.version
cimport
PY_MAJOR_VERSION
cdef
bint
IS_PY2
=
PY_MAJOR_VERSION
==
2
cdef
cfunc1
(
char
*
s
):
if
PY_MAJOR_VERSION
==
2
:
if
IS_PY
2
:
return
s
else
:
return
s
.
decode
(
'ASCII'
)
...
...
@@ -18,10 +21,10 @@ def test_one_arg_indexing(s):
>>> test_one_arg_indexing(b'xyz')
'y'
"""
cfunc1
(
s
[
0
])
z
=
cfunc1
(
s
[
2
])
cfunc1
(
s
[
0
])
if
IS_PY2
else
cfunc1
(
s
[:
1
])
z
=
cfunc1
(
s
[
2
])
if
IS_PY2
else
cfunc1
(
s
[
2
:])
assert
z
==
'z'
,
repr
(
z
)
return
cfunc1
(
s
[
1
])
return
cfunc1
(
s
[
1
])
if
IS_PY2
else
cfunc1
(
s
[
1
:
2
])
def
test_more_args_indexing
(
s
):
...
...
@@ -29,10 +32,10 @@ def test_more_args_indexing(s):
>>> test_more_args_indexing(b'xyz')
'y'
"""
cfunc3
(
1
,
s
[
0
],
6.5
)
z
=
cfunc3
(
2
,
s
[
2
],
'abc'
*
2
)
cfunc3
(
1
,
s
[
0
if
IS_PY2
else
slice
(
0
,
1
)
],
6.5
)
z
=
cfunc3
(
2
,
s
[
2
if
IS_PY2
else
slice
(
2
,
None
)
],
'abc'
*
2
)
assert
z
==
'z'
,
repr
(
z
)
return
cfunc3
(
3
,
s
[
1
],
1
)
return
cfunc3
(
3
,
s
[
1
if
IS_PY2
else
slice
(
1
,
2
)
],
1
)
def
test_one_arg_slicing
(
s
):
...
...
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