Skip to content

Commit 5bea973

Browse files
committed
Update tests to use correct types.
1 parent 4587508 commit 5bea973

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

axelrod/tests/unit/test_eigen.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,28 @@ def test_identity_matrices(self):
1616
assert_array_almost_equal(evector, _normalise(numpy.ones(size)))
1717

1818
def test_2x2_matrix(self):
19-
mat = [[2, 1], [1, 2]]
19+
mat = numpy.array([[2, 1], [1, 2]])
2020
evector, evalue = principal_eigenvector(mat)
2121
self.assertAlmostEqual(evalue, 3)
2222
assert_array_almost_equal(evector, numpy.dot(mat, evector) / evalue)
23-
assert_array_almost_equal(evector, _normalise([1, 1]))
23+
assert_array_almost_equal(evector, _normalise(numpy.array([1, 1])))
2424

2525
def test_3x3_matrix(self):
26-
mat = [[1, 2, 0], [-2, 1, 2], [1, 3, 1]]
26+
mat = numpy.array([[1, 2, 0], [-2, 1, 2], [1, 3, 1]])
2727
evector, evalue = principal_eigenvector(
2828
mat, maximum_iterations=None, max_error=1e-10
2929
)
3030
self.assertAlmostEqual(evalue, 3)
3131
assert_array_almost_equal(evector, numpy.dot(mat, evector) / evalue)
32-
assert_array_almost_equal(evector, _normalise([0.5, 0.5, 1]))
32+
assert_array_almost_equal(evector, _normalise(numpy.array([0.5, 0.5, 1])))
3333

3434
def test_4x4_matrix(self):
35-
mat = [[2, 0, 0, 0], [1, 2, 0, 0], [0, 1, 3, 0], [0, 0, 1, 3]]
35+
mat = numpy.array([[2, 0, 0, 0], [1, 2, 0, 0], [0, 1, 3, 0], [0, 0, 1, 3]])
3636
evector, evalue = principal_eigenvector(
3737
mat, maximum_iterations=None, max_error=1e-10
3838
)
3939
self.assertAlmostEqual(evalue, 3, places=3)
4040
assert_array_almost_equal(evector, numpy.dot(mat, evector) / evalue)
41-
assert_array_almost_equal(evector, _normalise([0, 0, 0, 1]), decimal=4)
41+
assert_array_almost_equal(
42+
evector, _normalise(numpy.array([0, 0, 0, 1])), decimal=4
43+
)

0 commit comments

Comments
 (0)