Example #1
0
def test_ml_messge_consistency():
    """Test the consistency of the message."""
    dm = DataModel("ml_datamodel", [Attribute("dataset_id", str, True)])
    query = Query([Constraint("dataset_id", ConstraintType("==", "fmnist"))], model=dm)
    msg = MlTradeMessage(performative=MlTradeMessage.Performative.CFP, query=query)
    with mock.patch.object(MlTradeMessage.Performative, "__eq__", return_value=False):
        assert not msg._is_consistent()
Example #2
0
def test_ml_wrong_message_creation():
    """Test the creation of a ml message."""
    msg = MlTradeMessage(performative=MlTradeMessage.Performative.CFP, query="")
    assert not msg._is_consistent()