提交 d6c912e5 authored 作者: Hengjean's avatar Hengjean

Modified version check

上级 77629a27
...@@ -2259,7 +2259,9 @@ def equal(x, y): ...@@ -2259,7 +2259,9 @@ def equal(x, y):
:note: At least one of `x` and `y` must be a sparse matrix. :note: At least one of `x` and `y` must be a sparse matrix.
""" """
assert scipy.__version__ >= '0.14.0' scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
assert scipy_ver >= [0, 14]
if hasattr(x, 'getnnz'): if hasattr(x, 'getnnz'):
x = as_sparse_variable(x) x = as_sparse_variable(x)
...@@ -2375,6 +2377,10 @@ def notEqual(x, y): ...@@ -2375,6 +2377,10 @@ def notEqual(x, y):
:note: At least one of `x` and `y` must be a sparse matrix. :note: At least one of `x` and `y` must be a sparse matrix.
""" """
scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
assert scipy_ver >= [0, 14]
if hasattr(x, 'getnnz'): if hasattr(x, 'getnnz'):
x = as_sparse_variable(x) x = as_sparse_variable(x)
if hasattr(y, 'getnnz'): if hasattr(y, 'getnnz'):
......
...@@ -658,7 +658,9 @@ class test_comparison(unittest.TestCase): ...@@ -658,7 +658,9 @@ class test_comparison(unittest.TestCase):
def test_equalss_csr(self): def test_equalss_csr(self):
if (scipy.__version__ < '0.14.0'): scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 14])):
raise SkipTest("comparison operators need newer release of scipy") raise SkipTest("comparison operators need newer release of scipy")
x = sparse.csr_matrix() x = sparse.csr_matrix()
...@@ -675,7 +677,9 @@ class test_comparison(unittest.TestCase): ...@@ -675,7 +677,9 @@ class test_comparison(unittest.TestCase):
def test_equalss_csc(self): def test_equalss_csc(self):
if (scipy.__version__ < '0.14.0'): scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 14])):
raise SkipTest("comparison operators need newer release of scipy") raise SkipTest("comparison operators need newer release of scipy")
x = sparse.csc_matrix() x = sparse.csc_matrix()
...@@ -692,7 +696,9 @@ class test_comparison(unittest.TestCase): ...@@ -692,7 +696,9 @@ class test_comparison(unittest.TestCase):
def test_not_equalss_csr(self): def test_not_equalss_csr(self):
if (scipy.__version__ < '0.14.0'): scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 14])):
raise SkipTest("comparison operators need newer release of scipy") raise SkipTest("comparison operators need newer release of scipy")
x = sparse.csr_matrix() x = sparse.csr_matrix()
...@@ -709,7 +715,9 @@ class test_comparison(unittest.TestCase): ...@@ -709,7 +715,9 @@ class test_comparison(unittest.TestCase):
def test_not_equalss_csc(self): def test_not_equalss_csc(self):
if (scipy.__version__ < '0.14.0'): scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 14])):
raise SkipTest("comparison operators need newer release of scipy") raise SkipTest("comparison operators need newer release of scipy")
x = sparse.csc_matrix() x = sparse.csc_matrix()
...@@ -726,7 +734,9 @@ class test_comparison(unittest.TestCase): ...@@ -726,7 +734,9 @@ class test_comparison(unittest.TestCase):
def test_equalsd_csr(self): def test_equalsd_csr(self):
if (scipy.__version__ < '0.14.0'): scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 14])):
raise SkipTest("comparison operators need newer release of scipy") raise SkipTest("comparison operators need newer release of scipy")
x = sparse.csr_matrix() x = sparse.csr_matrix()
...@@ -743,7 +753,9 @@ class test_comparison(unittest.TestCase): ...@@ -743,7 +753,9 @@ class test_comparison(unittest.TestCase):
def test_equalsd_csc(self): def test_equalsd_csc(self):
if (scipy.__version__ < '0.14.0'): scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 14])):
raise SkipTest("comparison operators need newer release of scipy") raise SkipTest("comparison operators need newer release of scipy")
x = sparse.csc_matrix() x = sparse.csc_matrix()
...@@ -760,7 +772,9 @@ class test_comparison(unittest.TestCase): ...@@ -760,7 +772,9 @@ class test_comparison(unittest.TestCase):
def test_not_equalsd_csr(self): def test_not_equalsd_csr(self):
if (scipy.__version__ < '0.14.0'): scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 14])):
raise SkipTest("comparison operators need newer release of scipy") raise SkipTest("comparison operators need newer release of scipy")
x = sparse.csr_matrix() x = sparse.csr_matrix()
...@@ -777,7 +791,9 @@ class test_comparison(unittest.TestCase): ...@@ -777,7 +791,9 @@ class test_comparison(unittest.TestCase):
def test_not_equalsd_csc(self): def test_not_equalsd_csc(self):
if (scipy.__version__ < '0.14.0'): scipy_ver = [int(n) for n in scipy.__version__.split('.')[:2]]
if (bool(scipy_ver < [0, 14])):
raise SkipTest("comparison operators need newer release of scipy") raise SkipTest("comparison operators need newer release of scipy")
x = sparse.csc_matrix() x = sparse.csc_matrix()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论