def test_create_invalid_message_type(msgid, expected): with pytest.raises(InvalidMessageError) as cm: utils.MessageDefinition("checker", msgid, "msg", "descr", "symbol", "scope") assert str(cm.value) == expected
def test_create_invalid_message_type(self): with self.assertRaises(InvalidMessageError) as cm: utils.MessageDefinition('checker', 'Q1234', 'msg', 'descr', 'symbol', 'scope') self.assertEqual(str(cm.exception), "Bad message type Q in 'Q1234'")
def test_create_invalid_message_type(msgid, expected): with pytest.raises(InvalidMessageError) as cm: utils.MessageDefinition('checker', msgid, 'msg', 'descr', 'symbol', 'scope') assert str(cm.value) == expected
def test_create_invalid_msgid(self): with self.assertRaises(InvalidMessageError) as cm: utils.MessageDefinition('checker', 'W12345', 'msg', 'descr', 'symbol', 'scope') self.assertEqual(str(cm.exception), "Invalid message id 'W12345'")