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
afff93a1
Commit
afff93a1
authored
Aug 12, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comment out ___XXXslice__ methods so we don't break Py3 tests.
parent
04a763d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
43 deletions
+49
-43
tests/run/special_methods_T561.pyx
tests/run/special_methods_T561.pyx
+49
-43
No files found.
tests/run/special_methods_T561.pyx
View file @
afff93a1
...
...
@@ -175,33 +175,6 @@ __doc__ = u"""
>>> vs0_getitem = vs0.__getitem__
>>> vs0_getitem('foo')
VS __getitem__ 0['foo']
>>> vs0_getslice = vs0.__getslice__
>>> vs0_getslice(13, 42)
VS __getslice__ 0 13 42
>>> # If you define either setslice or delslice, you get wrapper objects
>>> # for both methods. (This behavior is unchanged by #561.)
>>> ss_setslice = SetSlice().__setslice__
>>> ss_setslice(13, 42, 'foo')
SetSlice setslice 13 42 'foo'
>>> ss_delslice = SetSlice().__delslice__
>>> ss_delslice(13, 42)
Traceback (most recent call last):
...
NotImplementedError: 2-element slice deletion not supported by special_methods_T561.SetSlice
>>> ds_setslice = DelSlice().__setslice__
>>> ds_setslice(13, 42, 'foo')
Traceback (most recent call last):
...
NotImplementedError: 2-element slice assignment not supported by special_methods_T561.DelSlice
>>> ds_delslice = DelSlice().__delslice__
>>> ds_delslice(13, 42)
DelSlice delslice 13 42
>>> sds_setslice = SetDelSlice().__setslice__
>>> sds_setslice(13, 42, 'foo')
SetDelSlice setslice 13 42 'foo'
>>> sds_delslice = SetDelSlice().__delslice__
>>> sds_delslice(13, 42)
SetDelSlice delslice 13 42
>>> vs0_contains = vs0.__contains__
>>> vs0_contains(vs1)
VS __contains__ 0 1
...
...
@@ -365,6 +338,39 @@ __doc__ = u"""
Long __long__
"""
# Not tested because there is no way to conditionally compile this for
# Python 2.
unused
=
"""
>>> vs0_getslice = vs0.__getslice__
>>> vs0_getslice(13, 42)
VS __getslice__ 0 13 42
>>> # If you define either setslice or delslice, you get wrapper objects
>>> # for both methods. (This behavior is unchanged by #561.)
>>> ss_setslice = SetSlice().__setslice__
>>> ss_setslice(13, 42, 'foo')
SetSlice setslice 13 42 'foo'
>>> ss_delslice = SetSlice().__delslice__
>>> ss_delslice(13, 42)
Traceback (most recent call last):
...
NotImplementedError: 2-element slice deletion not supported by special_methods_T561.SetSlice
>>> ds_setslice = DelSlice().__setslice__
>>> ds_setslice(13, 42, 'foo')
Traceback (most recent call last):
...
NotImplementedError: 2-element slice assignment not supported by special_methods_T561.DelSlice
>>> ds_delslice = DelSlice().__delslice__
>>> ds_delslice(13, 42)
DelSlice delslice 13 42
>>> sds_setslice = SetDelSlice().__setslice__
>>> sds_setslice(13, 42, 'foo')
SetDelSlice setslice 13 42 'foo'
>>> sds_delslice = SetDelSlice().__delslice__
>>> sds_delslice(13, 42)
SetDelSlice delslice 13 42
"""
cdef
class
VerySpecial
:
cdef
readonly
int
value
...
...
@@ -491,8 +497,8 @@ cdef class VerySpecial:
def
__getitem__
(
self
,
index
):
print
"VS __getitem__ %d[%r]"
%
(
self
.
value
,
index
)
def
__getslice__
(
self
,
a
,
b
):
print
"VS __getslice__ %d %d %d"
%
(
self
.
value
,
a
,
b
)
#
def __getslice__(self, a, b):
#
print "VS __getslice__ %d %d %d" % (self.value, a, b)
def
__contains__
(
self
,
other
):
print
"VS __contains__ %d %d"
%
(
self
.
value
,
other
.
value
)
...
...
@@ -528,20 +534,20 @@ cdef class VerySpecial:
def
__get__
(
self
,
inst
,
own
):
print
"VS __get__ %d %r %r"
%
(
self
.
value
,
inst
,
own
)
cdef
class
SetSlice
:
def
__setslice__
(
self
,
a
,
b
,
value
):
print
"SetSlice setslice %d %d %r"
%
(
a
,
b
,
value
)
cdef
class
DelSlice
:
def
__delslice__
(
self
,
a
,
b
):
print
"DelSlice delslice %d %d"
%
(
a
,
b
)
cdef
class
SetDelSlice
:
def
__setslice__
(
self
,
a
,
b
,
value
):
print
"SetDelSlice setslice %d %d %r"
%
(
a
,
b
,
value
)
def
__delslice__
(
self
,
a
,
b
):
print
"SetDelSlice delslice %d %d"
%
(
a
,
b
)
#
cdef class SetSlice:
#
def __setslice__(self, a, b, value):
#
print "SetSlice setslice %d %d %r" % (a, b, value)
#
#
cdef class DelSlice:
#
def __delslice__(self, a, b):
#
print "DelSlice delslice %d %d" % (a, b)
#
#
cdef class SetDelSlice:
#
def __setslice__(self, a, b, value):
#
print "SetDelSlice setslice %d %d %r" % (a, b, value)
#
#
def __delslice__(self, a, b):
#
print "SetDelSlice delslice %d %d" % (a, b)
cdef
class
SetItem
:
def
__setitem__
(
self
,
index
,
value
):
...
...
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