@@ -21,38 +21,46 @@ def setUp(self):
2121 def tearDown (self ):
2222 pass
2323
24+
25+ # pylint: disable=R0201
2426 def testJsonRpcMessageRequestCorrect (self ):
2527 expected = JsonRpcRequest (1 , 'login' , ['user' , 'password' ])
2628 actual = JsonRpcMessage .Request (1 , 'login' , ['user' , 'password' ])
2729 testutils .assertEqualObjects (expected , actual )
2830
31+ # pylint: disable=R0201
2932 def testJsonRpcMessageRequestNoParamsCorrect (self ):
3033 expected = JsonRpcRequest (1 , 'login' )
3134 actual = JsonRpcMessage .Request (1 , 'login' )
3235 testutils .assertEqualObjects (expected , actual )
3336
37+ # pylint: disable=R0201
3438 def testJsonRpcMessageNotificationCorrect (self ):
3539 expected = JsonRpcNotification ('alarm' , ['a' , 'b' ])
3640 actual = JsonRpcMessage .Notification ('alarm' , ['a' , 'b' ])
3741 testutils .assertEqualObjects (expected , actual )
3842
43+ # pylint: disable=R0201
3944 def testJsonRpcMessageNotificationNoParamsCorrect (self ):
4045 expected = JsonRpcNotification ('alarm' )
4146 actual = JsonRpcMessage .Notification ('alarm' )
4247 testutils .assertEqualObjects (expected , actual )
4348
49+ # pylint: disable=R0201
4450 def testJsonRpcMessageSuccessCorrect (self ):
4551 expected = JsonRpcSuccessResponse (1 , 1107 )
4652 actual = JsonRpcMessage .Success (1 , 1107 )
4753 testutils .assertEqualObjects (expected , actual )
4854
55+ # pylint: disable=R0201
4956 def testJsonRpcMessageErrorCorrect (self ):
5057 expected = JsonRpcErrorResponse (
5158 1 , JsonRpcError (- 32001 , 'Err MSG' , [105 , 106 ]))
5259 actual = JsonRpcMessage .Error (
5360 1 , JsonRpcError (- 32001 , 'Err MSG' , [105 , 106 ]))
5461 testutils .assertEqualObjects (expected , actual )
5562
63+ # pylint: disable=R0201
5664 def testJsonRpcMessageAsJsonCorrect (self ):
5765 # request
5866 expected = '{\n "id": 1,\n "method": "login",' + \
@@ -79,6 +87,7 @@ def testJsonRpcMessageAsJsonCorrect(self):
7987 actual = JsonRpcMessage .AsJson (msg , indent = False , escape = True )
8088 self .assertEqual (expected , actual )
8189
90+ # pylint: disable=R0201
8291 def testJsonRpcRequestCorrect (self ):
8392 '''Checks object inheritance, structure, init'''
8493 msg = JsonRpcRequest (1 , 'methodName' , 'params' )
@@ -90,6 +99,7 @@ def testJsonRpcRequestCorrect(self):
9099 self .assertEqual ('methodName' , msg .method )
91100 self .assertEqual ('params' , msg .params )
92101
102+ # pylint: disable=R0201
93103 def testJsonRpcNotificationCorrect (self ):
94104 '''Checks object inheritance, structure, init'''
95105 msg = JsonRpcNotification ('ntfName' , 'params' )
@@ -100,6 +110,7 @@ def testJsonRpcNotificationCorrect(self):
100110 self .assertEqual ('ntfName' , msg .method )
101111 self .assertEqual ('params' , msg .params )
102112
113+ # pylint: disable=R0201
103114 def testJsonRpcSuccessResponseCorrect (self ):
104115 '''Checks object inheritance, structure, init'''
105116 msg = JsonRpcSuccessResponse (1 , 'result-value' )
@@ -109,6 +120,7 @@ def testJsonRpcSuccessResponseCorrect(self):
109120 self .assertEqual (1 , msg .id )
110121 self .assertEqual ('result-value' , msg .result )
111122
123+ # pylint: disable=R0201
112124 def testJsonRpcErrorResponseCorrect (self ):
113125 '''Checks object inheritance, structure, init'''
114126 msg = JsonRpcErrorResponse (
@@ -122,6 +134,7 @@ def testJsonRpcErrorResponseCorrect(self):
122134 self .assertEqual (msg .error .message , 'TestError' )
123135 self .assertEqual (msg .error .data , 'Error-data' )
124136
137+ # pylint: disable=R0201
125138 def testInternalErrorCorrect1 (self ):
126139 msg = JsonRpcError .InternalError ('Error-data' )
127140 self .assertTrue (isinstance (msg , JsonRpcError ))
@@ -132,6 +145,7 @@ def testInternalErrorCorrect1(self):
132145 self .assertEqual ('Internal Error' , msg .message )
133146 self .assertEqual ('Error-data' , msg .data )
134147
148+ # pylint: disable=R0201
135149 def testInternalErrorCorrect2 (self ):
136150 msg = JsonRpcError .InternalError ()
137151 self .assertTrue (isinstance (msg , JsonRpcError ))
@@ -140,6 +154,7 @@ def testInternalErrorCorrect2(self):
140154 self .assertEqual (- 32603 , msg .code )
141155 self .assertEqual ('Internal Error' , msg .message )
142156
157+ # pylint: disable=R0201
143158 def testCustomErrorCorrect1 (self ):
144159 msg = JsonRpcError .Error (- 32099 , 'tes-msg' , 'Error-data' )
145160 self .assertTrue (isinstance (msg , JsonRpcError ))
@@ -150,6 +165,7 @@ def testCustomErrorCorrect1(self):
150165 self .assertEqual ('tes-msg' , msg .message )
151166 self .assertEqual ('Error-data' , msg .data )
152167
168+ # pylint: disable=R0201
153169 def testCustomErrorCorrect2 (self ):
154170 msg = JsonRpcError .Error (- 32099 , 'tes-msg' )
155171 self .assertTrue (isinstance (msg , JsonRpcError ))
@@ -158,6 +174,7 @@ def testCustomErrorCorrect2(self):
158174 self .assertEqual (- 32099 , msg .code )
159175 self .assertEqual ('tes-msg' , msg .message )
160176
177+ # pylint: disable=R0201
161178 def testParseRequest (self ):
162179 '''Checks if JSON-RPC 2.0 Request object parsed correct'''
163180 testReqJson = '''
@@ -174,6 +191,7 @@ def testParseRequest(self):
174191 actual = JsonRpcParsed .Parse (testReqJson )
175192 testutils .assertEqualObjects (expected , actual )
176193
194+ # pylint: disable=R0201
177195 def testParseRequestInvalidRaisesException (self ):
178196 '''Parse json with "id" only raises JsonRpcParseError'''
179197 testReqJson = '''
@@ -186,6 +204,7 @@ def testParseRequestInvalidRaisesException(self):
186204 expectedErr = JsonRpcError .InvalidRequest ('No reqired fields' )
187205 testutils .assertEqualObjects (expectedErr , context .exception .rpcError )
188206
207+ # pylint: disable=R0201
189208 def testParseNotificationReq (self ):
190209 '''Checks if JSON-RPC 2.0 Notification object parsed correct'''
191210 testReqJson = '''
@@ -201,6 +220,7 @@ def testParseNotificationReq(self):
201220 actual = JsonRpcParsed .Parse (testReqJson )
202221 testutils .assertEqualObjects (expected , actual )
203222
223+ # pylint: disable=R0201
204224 def testParseSuccessRes (self ):
205225 '''Checks if JSON-RPC 2.0 Success object parsed correct'''
206226 testReqJson = '''
@@ -216,6 +236,7 @@ def testParseSuccessRes(self):
216236 actual = JsonRpcParsed .Parse (testReqJson )
217237 testutils .assertEqualObjects (expected , actual )
218238
239+ # pylint: disable=R0201
219240 def testParseErrorObj1 (self ):
220241 '''Checks if JSON-RPC 2.0 Error object parsed correct'''
221242 testReqJson = '''
@@ -236,6 +257,7 @@ def testParseErrorObj1(self):
236257 actual = JsonRpcParsed .Parse (testReqJson )
237258 testutils .assertEqualObjects (expected , actual )
238259
260+ # pylint: disable=R0201
239261 def testParseErrorObjInvalidCode1 (self ):
240262 '''Parse JSON-RPC 2.0 Error object with invalid code raises
241263 exception.'''
@@ -285,6 +307,7 @@ def SubGetErrornousErrObj(code):
285307 'Invalid JSON-RPC 2.0 Error code' )
286308 testutils .assertEqualObjects (expectedErr , context .exception .rpcError )
287309
310+ # pylint: disable=R0201
288311 def testParseReturnsParseError (self ):
289312 '''Parse found invalid json'''
290313 testReqJson = """{INVALID_JSON}"""
@@ -293,6 +316,7 @@ def testParseReturnsParseError(self):
293316 expectedErr = JsonRpcError .ParseError ('{INVALID_JSON}' )
294317 testutils .assertEqualObjects (expectedErr , context .exception .rpcError )
295318
319+ # pylint: disable=R0201
296320 def testParseInvalidHeader1 (self ):
297321 '''Parse found JSON-PRC message without jsonrpc field'''
298322
@@ -311,6 +335,7 @@ def testParseInvalidHeader1(self):
311335 'Message have no "jsonrpc" field' )
312336 testutils .assertEqualObjects (expectedErr , context .exception .rpcError )
313337
338+ # pylint: disable=R0201
314339 def testParseInvalidHeader2 (self ):
315340 '''Parse found JSON-PRC message jsonrpc wrong version'''
316341
@@ -329,6 +354,7 @@ def testParseInvalidHeader2(self):
329354 '"jsonrpc" field value should be 2.0' )
330355 testutils .assertEqualObjects (expectedErr , context .exception .rpcError )
331356
357+ # pylint: disable=R0201
332358 def testParseInvalidNotifyReq1 (self ):
333359 '''Parse found JSON-PRC 2.0 Notify Request without method field'''
334360
@@ -340,6 +366,7 @@ def testParseInvalidNotifyReq1(self):
340366 expectedErr = JsonRpcError .InvalidRequest ('No "method" field' )
341367 testutils .assertEqualObjects (expectedErr , context .exception .rpcError )
342368
369+ # pylint: disable=R0201
343370 def testParseInvalidNotifyReq2 (self ):
344371 '''Parse found JSON-PRC 2.0 Notify Request where method is null'''
345372
@@ -353,6 +380,7 @@ def testParseInvalidNotifyReq2(self):
353380 'Invalid "method" field value' )
354381 testutils .assertEqualObjects (expectedErr , context .exception .rpcError )
355382
383+ # pylint: disable=R0201
356384 def testParseInvalidNotifyReq3 (self ):
357385 '''Parse found JSON-PRC 2.0 Notify Request where method is empty'''
358386
@@ -366,6 +394,7 @@ def testParseInvalidNotifyReq3(self):
366394 'Invalid "method" field value' )
367395 testutils .assertEqualObjects (expectedErr , context .exception .rpcError )
368396
397+ # pylint: disable=R0201
369398 def testParseInvalidErrorRes1 (self ):
370399 '''Parse found JSON-PRC 2.0 Response Error where error object has
371400 invalid structure.'''
0 commit comments