def test_probabilities():
    """Tests aggregated probabilities for multiple measurementr in a workflow."""

    # 3-dimensional model, 2-events time window
    model = AngularModel(3, 2)
    # Define an input data sequence (tau = 2)
    input_data = list()
    input_data.append([0.8, 0.8, 1])
    input_data.append([0.9, 0.6, 0.9])
    # Encode the sequence in the model
    for t in range(model.tau):
        for dim in range(model.n):
            model.encode(input_data[t][dim], dim)
    # Check if at least 70% of the shots are 111 (coherent with the input)
    shots = 10000
    result = model.measure(shots)
    assert result["111"] / shots >= 0.7

    # Check again for a different input
    model.clear()
    # Define an input data sequence (tau = 2)
    input_data = list()
    input_data.append([0.1, 0.2, 1])
    input_data.append([0.0, 0.1, 0.9])
    # Encode the sequence in the model
    for t in range(model.tau):
        for dim in range(model.n):
            model.encode(input_data[t][dim], dim)
    # Check if at least 70% of the shots are 111 (coherent with the input)
    result = model.measure(shots)
    assert result["100"] / shots >= 0.8
def test_clear():
    """Tests if clear is working correctly"""
    model = AngularModel(n=2, tau=2)
    model.clear()