Skip to content

Changes to note_off causing issues #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Russ-M opened this issue Sep 7, 2021 · 4 comments · Fixed by #44
Closed

Changes to note_off causing issues #42

Russ-M opened this issue Sep 7, 2021 · 4 comments · Fixed by #44
Assignees

Comments

@Russ-M
Copy link

Russ-M commented Sep 7, 2021

Hi there.
I was trying to run the 'examples/midi_inoutdemo.py' script today and had a problem.
It seems the changes made by @dherrada in #33 to note_off.py - specifically changing the class variables to be preceded by an underscore (eg self.note is now self._note) mean that the demo crashes out at line 65 because 'NoteOff' has no attribute 'note'.
Why were these changes to note_off.py necessary? And is the best fix to revert the changes, add getter methods for 'note' etc, or change the example code?
I haven't managed to try it yet, but I'm a bit confused as to why this would not also cause an error when running 'tests/test_MIDI_unittests.py' since this looks like it would simulate this.

@evaherrada
Copy link
Collaborator

Ah yeah I think you're right. Will fix

@evaherrada evaherrada self-assigned this Sep 7, 2021
@kevinjwalters
Copy link

@Russ-M You're quite right, the tests do reveal that someone broke NoteOff.

Sat 18 Sep 17:13:29 BST 2021
test_captured_data_one_byte_reads (__main__.Test_MIDI) ... ok
test_larger_than_buffer_sysex (__main__.Test_MIDI) ... ok
test_running_status_when_implemented (__main__.Test_MIDI) ... ok
test_smallsysex_between_notes (__main__.Test_MIDI) ... ERROR
test_smallsysex_bytes_type (__main__.Test_MIDI) ... ok
test_somegood_somemissing_databytes (__main__.Test_MIDI) ... ok
test_unknown_before_NoteOn (__main__.Test_MIDI) ... ok
test_no_inout (__main__.Test_MIDI_constructor) ... ok
test_send_badnotes (__main__.Test_MIDI_send) ... ok
test_send_basic_sequences (__main__.Test_MIDI_send) ... ok
test_send_basic_single (__main__.Test_MIDI_send) ... ok
test_termination_with_random_data (__main__.Test_MIDI_send)
Test with a random stream of bytes to ensure that the parsing code ... ok

======================================================================
ERROR: test_smallsysex_between_notes (__main__.Test_MIDI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test_MIDI_unittests.py", line 286, in test_smallsysex_between_notes
    self.assertEqual(msg3.note, 60)
AttributeError: 'NoteOff' object has no attribute 'note'

----------------------------------------------------------------------
Ran 12 tests in 0.649s

FAILED (errors=1)
test_NoteOff_constructor_bogusstring (__main__.Test_MIDIMessage_NoteOff_constructor) ... ok
test_NoteOff_constructor_string (__main__.Test_MIDIMessage_NoteOff_constructor) ... ERROR
test_NoteOff_constructor_upperrange1 (__main__.Test_MIDIMessage_NoteOff_constructor) ... ERROR
test_NoteOff_constructor_upperrange2 (__main__.Test_MIDIMessage_NoteOff_constructor) ... ok
test_NoteOff_constructor_valueerror1 (__main__.Test_MIDIMessage_NoteOff_constructor) ... ok
test_NoteOff_constructor_valueerror2 (__main__.Test_MIDIMessage_NoteOff_constructor) ... ok
test_NoteOff_constructor_valueerror3 (__main__.Test_MIDIMessage_NoteOff_constructor) ... ok
test_NoteOn_constructor_bogusstring (__main__.Test_MIDIMessage_NoteOn_constructor) ... ok
test_NoteOn_constructor_string (__main__.Test_MIDIMessage_NoteOn_constructor) ... ok
test_NoteOn_constructor_upperrange1 (__main__.Test_MIDIMessage_NoteOn_constructor) ... ok
test_NoteOn_constructor_upperrange2 (__main__.Test_MIDIMessage_NoteOn_constructor) ... ok
test_NoteOn_constructor_valueerror1 (__main__.Test_MIDIMessage_NoteOn_constructor) ... ok
test_NoteOn_constructor_valueerror2 (__main__.Test_MIDIMessage_NoteOn_constructor) ... ok
test_NoteOn_constructor_valueerror3 (__main__.Test_MIDIMessage_NoteOn_constructor) ... ok
test_Empty (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_NoteOn_awaitingthirdbyte (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_NoteOn_basic (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_NoteOn_constructor_int (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_NoteOn_partialandpreotherchannel1 (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_NoteOn_partialandpreotherchannel2 (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_NoteOn_postNoteOn (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_NoteOn_postpartialNoteOn (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_NoteOn_predatajunk (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_NoteOn_preotherchannel (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_NoteOn_preotherchannelplusintermediatejunk (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_NoteOn_prepartialsysex (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_NoteOn_wrongchannel (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_SystemExclusive_NoteOn (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_SystemExclusive_NoteOn_premalterminatedsysex (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok
test_Unknown_SinglebyteStatus (__main__.Test_MIDIMessage_from_message_byte_tests) ... ok

======================================================================
ERROR: test_NoteOff_constructor_string (__main__.Test_MIDIMessage_NoteOff_constructor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test_MIDIMessage_unittests.py", line 393, in test_NoteOff_constructor_string
    self.assertEqual(object1.note, 60)
AttributeError: 'NoteOff' object has no attribute 'note'

======================================================================
ERROR: test_NoteOff_constructor_upperrange1 (__main__.Test_MIDIMessage_NoteOff_constructor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test_MIDIMessage_unittests.py", line 423, in test_NoteOff_constructor_upperrange1
    self.assertEqual(object1.note, 127)
AttributeError: 'NoteOff' object has no attribute 'note'

----------------------------------------------------------------------
Ran 30 tests in 0.005s

FAILED (errors=2)
test_bad_text (__main__.Test_note_parser) ... ok
test_good_text (__main__.Test_note_parser) ... ok

----------------------------------------------------------------------
Ran 2 tests in 0.002s

OK

@tannewt
Copy link
Member

tannewt commented Sep 20, 2021

@dherrada Can you please take a look this week?

@evaherrada
Copy link
Collaborator

@tannewt My bad. Making a todo for this so I don't forget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants