def test_freeze_and_thaw(): """Test that messages are hashable.""" assert not is_frozen(thaw_message(freeze_message(Message('note_on'))))
def test_thawed_message_is_copy(): frozen_msg = FrozenMessage('note_on') thawed_msg = Message('note_on') assert thaw_message(frozen_msg) == thawed_msg
from mido.frozen import FrozenMessage, freeze_message, thaw_message msg = FrozenMessage('note_on') msgDict = {msg: 'interesting'} print(msgDict) #msg.note = 2 thawedMsg = thaw_message(msg) thawedMsg.note = 2 msg2 = freeze_message(thawedMsg) msgDict[msg2] = 'fun' print(msgDict)