Skip to content

Commit

Permalink
test changes for 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ozak committed May 14, 2015
1 parent d51944b commit fcdbb13
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions skimage/graph/tests/test_mcp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import numpy as np
from numpy.testing import (assert_array_equal,
assert_almost_equal,
Expand All @@ -13,7 +14,7 @@


def test_basic():
if np.version.version[2]>6:
if np.version.version[2]>6 or sys.version_info.major>2:
m = mcp.MCP(a, fully_connected=True)
else:
with expected_warnings(['Upgrading Numpy should decrease memory usage and increase speed.']):
Expand Down Expand Up @@ -58,7 +59,7 @@ def test_neg_inf():
(6, 1)]
test_neg = np.where(a == 1, -1, 0)
test_inf = np.where(a == 1, np.inf, 0)
if np.version.version[2]>6:
if np.version.version[2]>6 or sys.version_info.major>2:
m = mcp.MCP(test_neg, fully_connected=True)
else:
with expected_warnings(['Upgrading Numpy should decrease memory usage and increase speed.']):
Expand All @@ -67,7 +68,7 @@ def test_neg_inf():
return_path = m.traceback((6, 1))
assert_array_equal(costs, expected_costs)
assert_array_equal(return_path, expected_path)
if np.version.version[2]>6:
if np.version.version[2]>6 or sys.version_info.major>2:
m = mcp.MCP(test_inf, fully_connected=True)
else:
with expected_warnings(['Upgrading Numpy should decrease memory usage and increase speed.']):
Expand All @@ -79,7 +80,7 @@ def test_neg_inf():


def test_route():
if np.version.version[2]>6:
if np.version.version[2]>6 or sys.version_info.major>2:
return_path, cost = mcp.route_through_array(a, (1, 6), (7, 2),
geometric=True)
else:
Expand All @@ -102,7 +103,7 @@ def test_route():


def test_no_diagonal():
if np.version.version[2]>6:
if np.version.version[2]>6 or sys.version_info.major>2:
m = mcp.MCP(a, fully_connected=False)
else:
with expected_warnings(['Upgrading Numpy should decrease memory usage and increase speed.']):
Expand Down Expand Up @@ -136,7 +137,7 @@ def test_no_diagonal():

def test_offsets():
offsets = [(1, i) for i in range(10)] + [(1, -i) for i in range(1, 10)]
if np.version.version[2]>6:
if np.version.version[2]>6 or sys.version_info.major>2:
m = mcp.MCP(a, offsets=offsets)
else:
with expected_warnings(['Upgrading Numpy should decrease memory usage and increase speed.']):
Expand Down Expand Up @@ -165,7 +166,7 @@ def _test_random(shape):
(np.random.rand(len(shape)) * shape).astype(int)]
ends = [(np.random.rand(len(shape)) * shape).astype(int)
for i in range(4)]
if np.version.version[2]>6:
if np.version.version[2]>6 or sys.version_info.major>2:
m = mcp.MCP(a, fully_connected=True)
else:
with expected_warnings(['Upgrading Numpy should decrease memory usage and increase speed.']):
Expand Down

0 comments on commit fcdbb13

Please sign in to comment.