Commit 99b0f687 authored by Davis King's avatar Davis King

Fixed test to really work if numpy isn't installed.

parent a9ca83d2
...@@ -7,9 +7,9 @@ from pytest import raises ...@@ -7,9 +7,9 @@ from pytest import raises
try: try:
import numpy import numpy
have_numpy = True
except ImportError: except ImportError:
# Just skip these tests if numpy isn't installed have_numpy = False
exit(0)
def test_matrix_empty_init(): def test_matrix_empty_init():
...@@ -57,7 +57,8 @@ def test_matrix_from_list_as_column_vector(): ...@@ -57,7 +57,8 @@ def test_matrix_from_list_as_column_vector():
assert str(m) == "0 \n1 \n2" assert str(m) == "0 \n1 \n2"
def test_matrix_from_object_with_2d_shape(): if have_numpy:
def test_matrix_from_object_with_2d_shape():
m1 = numpy.array([[0, 1, 2], m1 = numpy.array([[0, 1, 2],
[3, 4, 5], [3, 4, 5],
[6, 7, 8]]) [6, 7, 8]])
...@@ -70,7 +71,7 @@ def test_matrix_from_object_with_2d_shape(): ...@@ -70,7 +71,7 @@ def test_matrix_from_object_with_2d_shape():
assert str(m) == "0 1 2 \n3 4 5 \n6 7 8" assert str(m) == "0 1 2 \n3 4 5 \n6 7 8"
def test_matrix_from_object_without_2d_shape(): def test_matrix_from_object_without_2d_shape():
with raises(IndexError): with raises(IndexError):
m1 = numpy.array([0, 1, 2]) m1 = numpy.array([0, 1, 2])
matrix(m1) matrix(m1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment