Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_creation_of_tableaux(self, M):
tableau = make_tableau(M)
number_of_strategies, dimension = M.shape
self.assertEqual(tableau.shape,
(number_of_strategies,
number_of_strategies + dimension + 1))
self.assertTrue(np.array_equal(tableau[:, dimension:-1],
np.eye(number_of_strategies)))
self.assertTrue(np.array_equal(tableau[:, -1],
np.ones(number_of_strategies)))
def test_creationg_of_particular_tableaux(self):
M = np.array([[3, 3],
[2, 5],
[0, 6]])
expected_tableau = np.array([[ 3., 3., 1., 0., 0., 1.],
[ 2., 5., 0., 1., 0., 1.],
[ 0., 6., 0., 0., 1., 1.]])
tableau = make_tableau(M)
self.assertTrue(np.array_equal(tableau, expected_tableau))
M = np.array([[3, 2, 3],
[2, 6, 1]])
expected_tableau = np.array([[ 3., 2., 3., 1., 0., 1.],
[ 2., 6., 1., 0., 1., 1.]])
tableau = make_tableau(M)
self.assertTrue(np.array_equal(tableau, expected_tableau))