def test_setting_message_sender_only_works_once(): c = MessagePassingComputation("c") c.message_sender = MagicMock() with pytest.raises(AttributeError): c.message_sender = MagicMock()
def test_setting_message_sender_on_computation(): c = MessagePassingComputation("c") c.message_sender = MagicMock() msg = Message("type") c.post_msg("target", msg) c.message_sender.assert_called_with("c", "target", msg, None, None)