gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / pylint / test / functional / unexpected_special_method_signature.py @ 745
History | View | Annotate | Download (3.12 KB)
1 |
"""Test for special methods implemented incorrectly."""
|
---|---|
2 |
|
3 |
# pylint: disable=missing-docstring, unused-argument, too-few-public-methods
|
4 |
# pylint: disable=invalid-name,too-many-arguments,bad-staticmethod-argument
|
5 |
|
6 |
class Invalid(object): |
7 |
|
8 |
def __enter__(self, other): # [unexpected-special-method-signature] |
9 |
pass
|
10 |
|
11 |
def __del__(self, other): # [unexpected-special-method-signature] |
12 |
pass
|
13 |
|
14 |
def __format__(self, other, other2): # [unexpected-special-method-signature] |
15 |
pass
|
16 |
|
17 |
def __setattr__(self): # [unexpected-special-method-signature] |
18 |
pass
|
19 |
|
20 |
def __round__(self, invalid, args): # [unexpected-special-method-signature] |
21 |
pass
|
22 |
|
23 |
def __deepcopy__(self, memo, other): # [unexpected-special-method-signature] |
24 |
pass
|
25 |
|
26 |
def __iter__(): # [no-method-argument] |
27 |
pass
|
28 |
|
29 |
@staticmethod
|
30 |
def __getattr__(self, nanana): # [unexpected-special-method-signature] |
31 |
pass
|
32 |
|
33 |
|
34 |
class FirstBadContextManager(object): |
35 |
def __enter__(self): |
36 |
return self |
37 |
def __exit__(self, exc_type): # [unexpected-special-method-signature] |
38 |
pass
|
39 |
|
40 |
class SecondBadContextManager(object): |
41 |
def __enter__(self): |
42 |
return self |
43 |
def __exit__(self, exc_type, value, tb, stack): # [unexpected-special-method-signature] |
44 |
pass
|
45 |
|
46 |
class ThirdBadContextManager(object): |
47 |
def __enter__(self): |
48 |
return self |
49 |
|
50 |
# +1: [unexpected-special-method-signature]
|
51 |
def __exit__(self, exc_type, value, tb, stack, *args): |
52 |
pass
|
53 |
|
54 |
|
55 |
class Async(object): |
56 |
|
57 |
def __aiter__(self, extra): # [unexpected-special-method-signature] |
58 |
pass
|
59 |
def __anext__(self, extra, argument): # [unexpected-special-method-signature] |
60 |
pass
|
61 |
def __await__(self, param): # [unexpected-special-method-signature] |
62 |
pass
|
63 |
def __aenter__(self, first): # [unexpected-special-method-signature] |
64 |
pass
|
65 |
def __aexit__(self): # [unexpected-special-method-signature] |
66 |
pass
|
67 |
|
68 |
|
69 |
class Valid(object): |
70 |
|
71 |
def __new__(cls, test, multiple, args): |
72 |
pass
|
73 |
|
74 |
def __init__(self, this, can, have, multiple, args, as_well): |
75 |
pass
|
76 |
|
77 |
def __call__(self, also, trv, for_this): |
78 |
pass
|
79 |
|
80 |
def __round__(self, n): |
81 |
pass
|
82 |
|
83 |
def __index__(self, n=42): |
84 |
"""Expects 0 args, but we are taking in account arguments with defaults."""
|
85 |
|
86 |
def __deepcopy__(self, memo): |
87 |
pass
|
88 |
|
89 |
def __format__(self, format_specification=''): |
90 |
pass
|
91 |
|
92 |
def __copy__(self, this=None, is_not=None, necessary=None): |
93 |
pass
|
94 |
|
95 |
@staticmethod
|
96 |
def __enter__(): |
97 |
pass
|
98 |
|
99 |
@staticmethod
|
100 |
def __getitem__(index): |
101 |
pass
|
102 |
|
103 |
|
104 |
class FirstGoodContextManager(object): |
105 |
def __enter__(self): |
106 |
return self |
107 |
def __exit__(self, exc_type, value, tb): |
108 |
pass
|
109 |
|
110 |
class SecondGoodContextManager(object): |
111 |
def __enter__(self): |
112 |
return self |
113 |
def __exit__(self, exc_type=None, value=None, tb=None): |
114 |
pass
|
115 |
|
116 |
class ThirdGoodContextManager(object): |
117 |
def __enter__(self): |
118 |
return self |
119 |
def __exit__(self, exc_type, *args): |
120 |
pass
|