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
0725fdd8
Commit
0725fdd8
authored
May 13, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test case for ticket 636
parent
d9dcbc32
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
+50
-0
tests/bugs.txt
tests/bugs.txt
+1
-0
tests/run/slice2_T636.pyx
tests/run/slice2_T636.pyx
+49
-0
No files found.
tests/bugs.txt
View file @
0725fdd8
...
...
@@ -18,6 +18,7 @@ for_from_pyvar_loop_T601
decorators_T593
temp_sideeffects_T654
class_scope_T671
slice2_T636
# CPython regression tests that don't current work:
pyregr.test_threadsignals
...
...
tests/run/slice2_T636.pyx
0 → 100644
View file @
0725fdd8
# mode: run
# ticket 636
# tag: slicing, getitem
class
Sliceable
(
object
):
"""
>>> sl = Sliceable()
>>> sl[1:2]
(1, 2, None)
>>> py_slice2(sl, 1, 2)
(1, 2, None)
>>> sl[1:None]
(1, None, None)
>>> py_slice2(sl, 1, None)
(1, None, None)
>>> sl[None:2]
(None, 2, None)
>>> py_slice2(sl, None, 2)
(None, 2, None)
>>> sl[None:None]
(None, None, None)
>>> py_slice2(sl, None, None)
(None, None, None)
"""
def
__getitem__
(
self
,
sl
):
return
(
sl
.
start
,
sl
.
stop
,
sl
.
step
)
def
py_slice2
(
obj
,
a
,
b
):
"""
>>> [1,2,3][1:2]
[2]
>>> py_slice2([1,2,3], 1, 2)
[2]
>>> [1,2,3][None:2]
[1, 2]
>>> py_slice2([1,2,3], None, 2)
[1, 2]
>>> [1,2,3][None:None]
[1, 2, 3]
>>> py_slice2([1,2,3], None, None)
[1, 2, 3]
"""
return
obj
[
a
:
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