Skip to content

Commit

Permalink
Added many more ignores, fixed some variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
evaherrada committed Mar 19, 2021
1 parent d361d81 commit 2de0cec
Show file tree
Hide file tree
Showing 2 changed files with 186 additions and 153 deletions.
91 changes: 57 additions & 34 deletions tests/test_MIDIMessage_unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@

# pylint: enable=wrong-import-position


class Test_MIDIMessage_from_message_byte_tests(
unittest.TestCase
): # pylint: disable=invalid-name
def test_NoteOn_basic(self):
# pylint: disable=invalid-name
class Test_MIDIMessage_from_message_byte_tests(unittest.TestCase):
# pylint: enable=invalid-name
def test_NoteOn_basic(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0x90, 0x30, 0x7F])
ichannel = 0

Expand All @@ -49,7 +49,8 @@ def test_NoteOn_basic(self):
self.assertEqual(skipped, 0)
self.assertEqual(msg.channel, 0)

def test_NoteOn_awaitingthirdbyte(self):
def test_NoteOn_awaitingthirdbyte(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0x90, 0x30])
ichannel = 0

Expand All @@ -69,7 +70,8 @@ def test_NoteOn_awaitingthirdbyte(self):
)
self.assertEqual(skipped, 0)

def test_NoteOn_predatajunk(self):
def test_NoteOn_predatajunk(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0x20, 0x64, 0x90, 0x30, 0x32])
ichannel = 0

Expand All @@ -88,7 +90,8 @@ def test_NoteOn_predatajunk(self):
self.assertEqual(skipped, 2)
self.assertEqual(msg.channel, 0)

def test_NoteOn_prepartialsysex(self):
def test_NoteOn_prepartialsysex(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0x01, 0x02, 0x03, 0x04, 0xF7, 0x90, 0x30, 0x32])
ichannel = 0

Expand Down Expand Up @@ -124,7 +127,8 @@ def test_NoteOn_prepartialsysex(self):
self.assertEqual(skipped, 0)
self.assertEqual(msg.channel, 0)

def test_NoteOn_postNoteOn(self):
def test_NoteOn_postNoteOn(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0x90 | 0x08, 0x30, 0x7F, 0x90 | 0x08, 0x37, 0x64])
ichannel = 8

Expand All @@ -139,7 +143,8 @@ def test_NoteOn_postNoteOn(self):
self.assertEqual(skipped, 0)
self.assertEqual(msg.channel, 8)

def test_NoteOn_postpartialNoteOn(self):
def test_NoteOn_postpartialNoteOn(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0x90, 0x30, 0x7F, 0x90, 0x37])
ichannel = 0

Expand All @@ -154,7 +159,8 @@ def test_NoteOn_postpartialNoteOn(self):
self.assertEqual(skipped, 0)
self.assertEqual(msg.channel, 0)

def test_NoteOn_preotherchannel(self):
def test_NoteOn_preotherchannel(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0x90 | 0x05, 0x30, 0x7F, 0x90 | 0x03, 0x37, 0x64])
ichannel = 3

Expand All @@ -169,7 +175,10 @@ def test_NoteOn_preotherchannel(self):
self.assertEqual(skipped, 0)
self.assertEqual(msg.channel, 3)

def test_NoteOn_preotherchannelplusintermediatejunk(self):
def test_NoteOn_preotherchannelplusintermediatejunk(
self,
): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0x90 | 0x05, 0x30, 0x7F, 0x00, 0x00, 0x90 | 0x03, 0x37, 0x64])
ichannel = 3

Expand All @@ -186,7 +195,8 @@ def test_NoteOn_preotherchannelplusintermediatejunk(self):
self.assertEqual(skipped, 0)
self.assertEqual(msg.channel, 3)

def test_NoteOn_wrongchannel(self):
def test_NoteOn_wrongchannel(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0x95, 0x30, 0x7F])
ichannel = 3

Expand All @@ -198,7 +208,8 @@ def test_NoteOn_wrongchannel(self):
self.assertEqual(msgendidxplusone, 3, "wrong channel message discarded")
self.assertEqual(skipped, 0)

def test_NoteOn_partialandpreotherchannel1(self):
def test_NoteOn_partialandpreotherchannel1(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0x95, 0x30, 0x7F, 0x93])
ichannel = 3

Expand All @@ -212,7 +223,8 @@ def test_NoteOn_partialandpreotherchannel1(self):
)
self.assertEqual(skipped, 0)

def test_NoteOn_partialandpreotherchannel2(self):
def test_NoteOn_partialandpreotherchannel2(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0x95, 0x30, 0x7F, 0x93, 0x37])
ichannel = 3

Expand All @@ -226,7 +238,8 @@ def test_NoteOn_partialandpreotherchannel2(self):
)
self.assertEqual(skipped, 0)

def test_NoteOn_constructor_int(self):
def test_NoteOn_constructor_int(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
object1 = NoteOn(60, 0x7F)

self.assertEqual(object1.note, 60)
Expand All @@ -251,7 +264,8 @@ def test_NoteOn_constructor_int(self):
self.assertEqual(object4.velocity, 127)
self.assertIsNone(object4.channel)

def test_SystemExclusive_NoteOn(self):
def test_SystemExclusive_NoteOn(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0xF0, 0x42, 0x01, 0x02, 0x03, 0x04, 0xF7, 0x90 | 14, 0x30, 0x60])
ichannel = 14

Expand Down Expand Up @@ -279,7 +293,10 @@ def test_SystemExclusive_NoteOn(self):
self.assertEqual(skipped, 0)
self.assertEqual(msg.channel, 14)

def test_SystemExclusive_NoteOn_premalterminatedsysex(self):
def test_SystemExclusive_NoteOn_premalterminatedsysex(
self,
): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0xF0, 0x42, 0x01, 0x02, 0x03, 0x04, 0xF0, 0x90, 0x30, 0x32])
ichannel = 0

Expand All @@ -294,7 +311,8 @@ def test_SystemExclusive_NoteOn_premalterminatedsysex(self):
skipped, 0, "If SystemExclusive class is imported then this must be 0"
)

def test_Unknown_SinglebyteStatus(self):
def test_Unknown_SinglebyteStatus(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([0xFD])
ichannel = 0

Expand All @@ -307,7 +325,8 @@ def test_Unknown_SinglebyteStatus(self):
self.assertEqual(skipped, 0)
self.assertIsNone(msg.channel)

def test_Empty(self):
def test_Empty(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
data = bytes([])
ichannel = 0

Expand All @@ -323,7 +342,8 @@ def test_Empty(self):
class Test_MIDIMessage_NoteOn_constructor(
unittest.TestCase
): # pylint: disable=invalid-name
def test_NoteOn_constructor_string(self):
def test_NoteOn_constructor_string(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
object1 = NoteOn("C4", 0x64)
self.assertEqual(object1.note, 60)
self.assertEqual(object1.velocity, 0x64)
Expand All @@ -336,28 +356,29 @@ def test_NoteOn_constructor_string(self):
self.assertEqual(object3.note, 61)
self.assertEqual(object3.velocity, 0)

def test_NoteOn_constructor_valueerror1(self):
def test_NoteOn_constructor_valueerror1(self): # pylint: disable=invalid-name
with self.assertRaises(ValueError):
NoteOn(60, 0x80) # pylint is happier if return value not stored

def test_NoteOn_constructor_valueerror2(self):
def test_NoteOn_constructor_valueerror2(self): # pylint: disable=invalid-name
with self.assertRaises(ValueError):
NoteOn(-1, 0x7F)

def test_NoteOn_constructor_valueerror3(self):
def test_NoteOn_constructor_valueerror3(self): # pylint: disable=invalid-name
with self.assertRaises(ValueError):
NoteOn(128, 0x7F)

def test_NoteOn_constructor_upperrange1(self):
def test_NoteOn_constructor_upperrange1(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
object1 = NoteOn("G9", 0x7F)
self.assertEqual(object1.note, 127)
self.assertEqual(object1.velocity, 0x7F)

def test_NoteOn_constructor_upperrange2(self):
def test_NoteOn_constructor_upperrange2(self): # pylint: disable=invalid-name
with self.assertRaises(ValueError):
NoteOn("G#9", 0x7F) # just above max note

def test_NoteOn_constructor_bogusstring(self):
def test_NoteOn_constructor_bogusstring(self): # pylint: disable=invalid-name
with self.assertRaises(ValueError):
NoteOn("CC4", 0x7F)

Expand All @@ -366,7 +387,8 @@ class Test_MIDIMessage_NoteOff_constructor(
unittest.TestCase
): # pylint: disable=invalid-name
# mostly cut and paste from NoteOn above
def test_NoteOff_constructor_string(self):
def test_NoteOff_constructor_string(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
object1 = NoteOff("C4", 0x64)
self.assertEqual(object1.note, 60)
self.assertEqual(object1.velocity, 0x64)
Expand All @@ -383,28 +405,29 @@ def test_NoteOff_constructor_string(self):
self.assertEqual(object4.note, 61)
self.assertEqual(object4.velocity, 0)

def test_NoteOff_constructor_valueerror1(self):
def test_NoteOff_constructor_valueerror1(self): # pylint: disable=invalid-name
with self.assertRaises(ValueError):
NoteOff(60, 0x80)

def test_NoteOff_constructor_valueerror2(self):
def test_NoteOff_constructor_valueerror2(self): # pylint: disable=invalid-name
with self.assertRaises(ValueError):
NoteOff(-1, 0x7F)

def test_NoteOff_constructor_valueerror3(self):
def test_NoteOff_constructor_valueerror3(self): # pylint: disable=invalid-name
with self.assertRaises(ValueError):
NoteOff(128, 0x7F)

def test_NoteOff_constructor_upperrange1(self):
def test_NoteOff_constructor_upperrange1(self): # pylint: disable=invalid-name
# pylint: enable=invalid-name
object1 = NoteOff("G9", 0x7F)
self.assertEqual(object1.note, 127)
self.assertEqual(object1.velocity, 0x7F)

def test_NoteOff_constructor_upperrange2(self):
def test_NoteOff_constructor_upperrange2(self): # pylint: disable=invalid-name
with self.assertRaises(ValueError):
NoteOff("G#9", 0x7F) # just above max note

def test_NoteOff_constructor_bogusstring(self):
def test_NoteOff_constructor_bogusstring(self): # pylint: disable=invalid-name
with self.assertRaises(ValueError):
NoteOff("CC4", 0x7F)

Expand Down
Loading

0 comments on commit 2de0cec

Please sign in to comment.