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