Add tests for toqito/nonlocal_games/nonlocal_game.py: 155-156
https://github.com/vprusso/toqito/blob/f47dea627bbfcd4d2f232c88d83da1d4e3539b60/toqito/nonlocal_games/nonlocal_game.py#L153-L156
@vprusso Do you mind pointing me to a reference that might have an example to cover the above lines? I only the surface-level basics of how non-local games work.
Hmm, I think the best reference to point to here would just be the docs page, and specifically any of the subsections under: https://toqito.readthedocs.io/en/latest/tutorials.nonlocal_games.html
Even more specifically, an example like this:
import numpy as np
from toqito.nonlocal_games.nonlocal_game import NonlocalGame
# Specify the number of inputs, and number of outputs.
num_alice_in, num_alice_out = 2, 2
num_bob_in, num_bob_out = 2, 2
# Define the probability matrix of the FFL game.
prob_mat = np.array([[1/3, 1/3], [1/3, 0]])
# Define the predicate matrix of the FFL game.
pred_mat = np.zeros((num_alice_out, num_bob_out, num_alice_in, num_bob_in))
for a_alice in range(num_alice_out):
for b_bob in range(num_bob_out):
for x_alice in range(num_alice_in):
for y_bob in range(num_bob_in):
if (a_alice or x_alice) != (b_bob or y_bob):
pred_mat[a_alice, b_bob, x_alice, y_bob] = 1
# Define the FFL game object.
ffl = NonlocalGame(prob_mat, pred_mat)
should hit that section of nonlocal_game.py.
Does that help?
What's the use of defining a class in the test file?
https://github.com/vprusso/toqito/blob/fd70f8ebc4834a8944e197f2d293cc75b5a0796b/toqito/nonlocal_games/tests/test_nonlocal_game.py#L9
Not really any good usecase now. I think this is an older test pattern that we should probably update to use pytest and not use classes as it just makes the whole thing more confusing and also not aligned with the way in which the other tests are put together.
I think this is an older test pattern that we should probably update to use pytest and not use classes
Ok. Yeah. I think this applies to all test files in toqito/nonlocal_games/tests