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
13ed9319
Commit
13ed9319
authored
Dec 19, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test cleanup
parent
75b4f5d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
23 deletions
+32
-23
tests/run/delete.pyx
tests/run/delete.pyx
+32
-23
No files found.
tests/run/delete.pyx
View file @
13ed9319
"""
>>> a = A()
>>> a.f()
[2, 1]
>>> a.g()
(False, True)
>>> del_item({1: 'a', 2: 'b'}, 1)
{2: 'b'}
>>> del_item(list(range(10)), 2)
[0, 1, 3, 4, 5, 6, 7, 8, 9]
>>> del_dict({1: 'a', 2: 'b'}, 1)
class
A
(
object
):
{2: 'b'}
"""
>>> del_list(list(range(5)), 3)
>>> a = A()
[0, 1, 2, 4]
>>> a.f()
>>> del_int(list(range(5)), 3)
[2, 1]
[0, 1, 2, 4]
>>> a.g()
>>> del_list_int(list(range(5)), 3)
(False, True)
[0, 1, 2, 4]
"""
>>> del_int({-1: 'neg', 1: 'pos'}, -1)
{1: 'pos'}
"""
class
A
:
def
f
(
self
):
def
f
(
self
):
self
.
refs
=
[
3
,
2
,
1
]
self
.
refs
=
[
3
,
2
,
1
]
del
self
.
refs
[
0
]
del
self
.
refs
[
0
]
...
@@ -33,21 +18,45 @@ class A:
...
@@ -33,21 +18,45 @@ class A:
return
(
hasattr
(
self
,
u"a"
),
hasattr
(
self
,
u"g"
))
return
(
hasattr
(
self
,
u"a"
),
hasattr
(
self
,
u"g"
))
def
del_item
(
L
,
o
):
def
del_item
(
L
,
o
):
"""
>>> del_item({1: 'a', 2: 'b'}, 1)
{2: 'b'}
>>> del_item(list(range(10)), 2)
[0, 1, 3, 4, 5, 6, 7, 8, 9]
"""
del
L
[
o
]
del
L
[
o
]
return
L
return
L
def
del_dict
(
dict
D
,
o
):
def
del_dict
(
dict
D
,
o
):
"""
>>> del_dict({1: 'a', 2: 'b'}, 1)
{2: 'b'}
"""
del
D
[
o
]
del
D
[
o
]
return
D
return
D
def
del_list
(
list
L
,
o
):
def
del_list
(
list
L
,
o
):
"""
>>> del_list(list(range(5)), 3)
[0, 1, 2, 4]
"""
del
L
[
o
]
del
L
[
o
]
return
L
return
L
def
del_int
(
L
,
int
i
):
def
del_int
(
L
,
int
i
):
"""
>>> del_int(list(range(5)), 3)
[0, 1, 2, 4]
>>> del_int({-1: 'neg', 1: 'pos'}, -1)
{1: 'pos'}
"""
del
L
[
i
]
del
L
[
i
]
return
L
return
L
def
del_list_int
(
L
,
int
i
):
def
del_list_int
(
L
,
int
i
):
"""
>>> del_list_int(list(range(5)), 3)
[0, 1, 2, 4]
"""
del
L
[
i
]
del
L
[
i
]
return
L
return
L
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