1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# mode: run
# tag: list, set, builtins
# ticket: 688
_set = set
class TestObj(object):
pass
def _setattr(obj):
"""
>>> t = TestObj()
>>> _setattr(t) is None
True
>>> t.test is None
True
"""
setattr(obj, 'test', None)
return setattr(obj, 'test', None)
def _delattr(obj):
"""
>>> t = TestObj()
>>> t.test1 = t.test2 = True
>>> _delattr(t) is None
True
>>> hasattr(t, 'test1')
False
>>> hasattr(t, 'test2')
False
"""
delattr(obj, 'test1')
return delattr(obj, 'test2')
def list_sort(list l):
"""
>>> list_sort([1,2,3]) is None
True
"""
l.sort()
return l.sort()
def list_reverse(list l):
"""
>>> list_reverse([1,2,3]) is None
True
"""
l.reverse()
return l.reverse()
def list_insert(list l):
"""
>>> list_insert([1,2,3]) is None
True
"""
l.insert(1, 2)
return l.insert(1, 2)
def list_append(list l):
"""
>>> list_append([1,2,3]) is None
True
"""
l.append(1)
return l.append(2)
def set_clear(set s):
"""
>>> set_clear(_set([1,2,3])) is None
True
>>> set_clear(None)
Traceback (most recent call last):
AttributeError: 'NoneType' object has no attribute 'clear'
"""
s.clear()
return s.clear()
def set_discard(set s):
"""
>>> set_discard(_set([1,2,3])) is None
True
"""
s.discard(1)
return s.discard(2)
def set_add(set s):
"""
>>> set_add(_set([1,2,3])) is None
True
"""
s.add(1)
return s.add(2)
def dict_clear(dict d):
"""
>>> dict_clear({1:2,3:4}) is None
True
>>> dict_clear(None)
Traceback (most recent call last):
AttributeError: 'NoneType' object has no attribute 'clear'
"""
d.clear()
return d.clear()
|