1
- # pylint: disable=invalid-name
2
1
# SPDX-FileCopyrightText: 2019 Kevin J. Walters for Adafruit Industries
3
2
#
4
3
# SPDX-License-Identifier: MIT
5
- # pylint: enable=invalid-name
4
+
5
+ # pylint: disable=invalid-name
6
6
7
7
import unittest
8
8
32
32
33
33
# pylint: disable=invalid-name
34
34
class Test_MIDIMessage_from_message_byte_tests (unittest .TestCase ):
35
- # pylint: enable=invalid-name
36
35
def test_NoteOn_basic (self ): # pylint: disable=invalid-name
37
- # pylint: enable=invalid-name
38
36
data = bytes ([0x90 , 0x30 , 0x7F ])
39
37
ichannel = 0
40
38
@@ -50,7 +48,6 @@ def test_NoteOn_basic(self): # pylint: disable=invalid-name
50
48
self .assertEqual (msg .channel , 0 )
51
49
52
50
def test_NoteOn_awaitingthirdbyte (self ): # pylint: disable=invalid-name
53
- # pylint: enable=invalid-name
54
51
data = bytes ([0x90 , 0x30 ])
55
52
ichannel = 0
56
53
@@ -71,7 +68,6 @@ def test_NoteOn_awaitingthirdbyte(self): # pylint: disable=invalid-name
71
68
self .assertEqual (skipped , 0 )
72
69
73
70
def test_NoteOn_predatajunk (self ): # pylint: disable=invalid-name
74
- # pylint: enable=invalid-name
75
71
data = bytes ([0x20 , 0x64 , 0x90 , 0x30 , 0x32 ])
76
72
ichannel = 0
77
73
@@ -91,7 +87,6 @@ def test_NoteOn_predatajunk(self): # pylint: disable=invalid-name
91
87
self .assertEqual (msg .channel , 0 )
92
88
93
89
def test_NoteOn_prepartialsysex (self ): # pylint: disable=invalid-name
94
- # pylint: enable=invalid-name
95
90
data = bytes ([0x01 , 0x02 , 0x03 , 0x04 , 0xF7 , 0x90 , 0x30 , 0x32 ])
96
91
ichannel = 0
97
92
@@ -128,7 +123,6 @@ def test_NoteOn_prepartialsysex(self): # pylint: disable=invalid-name
128
123
self .assertEqual (msg .channel , 0 )
129
124
130
125
def test_NoteOn_postNoteOn (self ): # pylint: disable=invalid-name
131
- # pylint: enable=invalid-name
132
126
data = bytes ([0x90 | 0x08 , 0x30 , 0x7F , 0x90 | 0x08 , 0x37 , 0x64 ])
133
127
ichannel = 8
134
128
@@ -144,7 +138,6 @@ def test_NoteOn_postNoteOn(self): # pylint: disable=invalid-name
144
138
self .assertEqual (msg .channel , 8 )
145
139
146
140
def test_NoteOn_postpartialNoteOn (self ): # pylint: disable=invalid-name
147
- # pylint: enable=invalid-name
148
141
data = bytes ([0x90 , 0x30 , 0x7F , 0x90 , 0x37 ])
149
142
ichannel = 0
150
143
@@ -160,7 +153,6 @@ def test_NoteOn_postpartialNoteOn(self): # pylint: disable=invalid-name
160
153
self .assertEqual (msg .channel , 0 )
161
154
162
155
def test_NoteOn_preotherchannel (self ): # pylint: disable=invalid-name
163
- # pylint: enable=invalid-name
164
156
data = bytes ([0x90 | 0x05 , 0x30 , 0x7F , 0x90 | 0x03 , 0x37 , 0x64 ])
165
157
ichannel = 3
166
158
@@ -175,10 +167,9 @@ def test_NoteOn_preotherchannel(self): # pylint: disable=invalid-name
175
167
self .assertEqual (skipped , 0 )
176
168
self .assertEqual (msg .channel , 3 )
177
169
178
- def test_NoteOn_preotherchannelplusintermediatejunk (
170
+ def test_NoteOn_preotherchannelplusintermediatejunk ( # pylint: disable=invalid-name
179
171
self ,
180
- ): # pylint: disable=invalid-name
181
- # pylint: enable=invalid-name
172
+ ):
182
173
data = bytes ([0x90 | 0x05 , 0x30 , 0x7F , 0x00 , 0x00 , 0x90 | 0x03 , 0x37 , 0x64 ])
183
174
ichannel = 3
184
175
@@ -196,7 +187,6 @@ def test_NoteOn_preotherchannelplusintermediatejunk(
196
187
self .assertEqual (msg .channel , 3 )
197
188
198
189
def test_NoteOn_wrongchannel (self ): # pylint: disable=invalid-name
199
- # pylint: enable=invalid-name
200
190
data = bytes ([0x95 , 0x30 , 0x7F ])
201
191
ichannel = 3
202
192
@@ -209,7 +199,6 @@ def test_NoteOn_wrongchannel(self): # pylint: disable=invalid-name
209
199
self .assertEqual (skipped , 0 )
210
200
211
201
def test_NoteOn_partialandpreotherchannel1 (self ): # pylint: disable=invalid-name
212
- # pylint: enable=invalid-name
213
202
data = bytes ([0x95 , 0x30 , 0x7F , 0x93 ])
214
203
ichannel = 3
215
204
@@ -224,7 +213,6 @@ def test_NoteOn_partialandpreotherchannel1(self): # pylint: disable=invalid-nam
224
213
self .assertEqual (skipped , 0 )
225
214
226
215
def test_NoteOn_partialandpreotherchannel2 (self ): # pylint: disable=invalid-name
227
- # pylint: enable=invalid-name
228
216
data = bytes ([0x95 , 0x30 , 0x7F , 0x93 , 0x37 ])
229
217
ichannel = 3
230
218
@@ -239,7 +227,6 @@ def test_NoteOn_partialandpreotherchannel2(self): # pylint: disable=invalid-nam
239
227
self .assertEqual (skipped , 0 )
240
228
241
229
def test_NoteOn_constructor_int (self ): # pylint: disable=invalid-name
242
- # pylint: enable=invalid-name
243
230
object1 = NoteOn (60 , 0x7F )
244
231
245
232
self .assertEqual (object1 .note , 60 )
@@ -265,7 +252,6 @@ def test_NoteOn_constructor_int(self): # pylint: disable=invalid-name
265
252
self .assertIsNone (object4 .channel )
266
253
267
254
def test_SystemExclusive_NoteOn (self ): # pylint: disable=invalid-name
268
- # pylint: enable=invalid-name
269
255
data = bytes ([0xF0 , 0x42 , 0x01 , 0x02 , 0x03 , 0x04 , 0xF7 , 0x90 | 14 , 0x30 , 0x60 ])
270
256
ichannel = 14
271
257
@@ -293,10 +279,9 @@ def test_SystemExclusive_NoteOn(self): # pylint: disable=invalid-name
293
279
self .assertEqual (skipped , 0 )
294
280
self .assertEqual (msg .channel , 14 )
295
281
296
- def test_SystemExclusive_NoteOn_premalterminatedsysex (
282
+ def test_SystemExclusive_NoteOn_premalterminatedsysex ( # pylint: disable=invalid-name
297
283
self ,
298
- ): # pylint: disable=invalid-name
299
- # pylint: enable=invalid-name
284
+ ):
300
285
data = bytes ([0xF0 , 0x42 , 0x01 , 0x02 , 0x03 , 0x04 , 0xF0 , 0x90 , 0x30 , 0x32 ])
301
286
ichannel = 0
302
287
@@ -312,7 +297,6 @@ def test_SystemExclusive_NoteOn_premalterminatedsysex(
312
297
)
313
298
314
299
def test_Unknown_SinglebyteStatus (self ): # pylint: disable=invalid-name
315
- # pylint: enable=invalid-name
316
300
data = bytes ([0xFD ])
317
301
ichannel = 0
318
302
@@ -326,7 +310,6 @@ def test_Unknown_SinglebyteStatus(self): # pylint: disable=invalid-name
326
310
self .assertIsNone (msg .channel )
327
311
328
312
def test_Empty (self ): # pylint: disable=invalid-name
329
- # pylint: enable=invalid-name
330
313
data = bytes ([])
331
314
ichannel = 0
332
315
@@ -343,7 +326,6 @@ class Test_MIDIMessage_NoteOn_constructor(
343
326
unittest .TestCase
344
327
): # pylint: disable=invalid-name
345
328
def test_NoteOn_constructor_string (self ): # pylint: disable=invalid-name
346
- # pylint: enable=invalid-name
347
329
object1 = NoteOn ("C4" , 0x64 )
348
330
self .assertEqual (object1 .note , 60 )
349
331
self .assertEqual (object1 .velocity , 0x64 )
@@ -369,7 +351,6 @@ def test_NoteOn_constructor_valueerror3(self): # pylint: disable=invalid-name
369
351
NoteOn (128 , 0x7F )
370
352
371
353
def test_NoteOn_constructor_upperrange1 (self ): # pylint: disable=invalid-name
372
- # pylint: enable=invalid-name
373
354
object1 = NoteOn ("G9" , 0x7F )
374
355
self .assertEqual (object1 .note , 127 )
375
356
self .assertEqual (object1 .velocity , 0x7F )
@@ -383,12 +364,11 @@ def test_NoteOn_constructor_bogusstring(self): # pylint: disable=invalid-name
383
364
NoteOn ("CC4" , 0x7F )
384
365
385
366
386
- class Test_MIDIMessage_NoteOff_constructor (
367
+ class Test_MIDIMessage_NoteOff_constructor ( # pylint: disable=invalid-name
387
368
unittest .TestCase
388
- ): # pylint: disable=invalid-name
369
+ ):
389
370
# mostly cut and paste from NoteOn above
390
371
def test_NoteOff_constructor_string (self ): # pylint: disable=invalid-name
391
- # pylint: enable=invalid-name
392
372
object1 = NoteOff ("C4" , 0x64 )
393
373
self .assertEqual (object1 .note , 60 )
394
374
self .assertEqual (object1 .velocity , 0x64 )
@@ -418,7 +398,6 @@ def test_NoteOff_constructor_valueerror3(self): # pylint: disable=invalid-name
418
398
NoteOff (128 , 0x7F )
419
399
420
400
def test_NoteOff_constructor_upperrange1 (self ): # pylint: disable=invalid-name
421
- # pylint: enable=invalid-name
422
401
object1 = NoteOff ("G9" , 0x7F )
423
402
self .assertEqual (object1 .note , 127 )
424
403
self .assertEqual (object1 .velocity , 0x7F )
0 commit comments