Skip to content

Commit f82aef3

Browse files
RandomY-2wjsi
andauthored
Update pytest imports for test_special.py (#3129)
Co-authored-by: Wenjun Si <[email protected]>
1 parent ff0e925 commit f82aef3

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

mars/tensor/special/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,7 @@
151151
)
152152
except ImportError: # pragma: no cover
153153
pass
154+
155+
_names_to_del = [_name for _name, _val in globals().items() if _val is None]
156+
[globals().pop(_name) for _name in _names_to_del]
157+
del _names_to_del

mars/tensor/special/ellip_func_integrals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,4 @@ def elliprj(x, y, z, p, **kwargs):
154154
except AttributeError:
155155
# These functions are not implemented before scipy v1.8 so
156156
# spsecial.func may cause AttributeError
157-
pass
157+
elliprc = elliprd = elliprf = elliprg = elliprj = None

mars/tensor/special/tests/test_special.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@
2828
ellipkinc as scipy_ellipkinc,
2929
ellipe as scipy_ellipe,
3030
ellipeinc as scipy_ellipeinc,
31-
elliprc as scipy_elliprc,
32-
elliprd as scipy_elliprd,
33-
elliprf as scipy_elliprf,
34-
elliprg as scipy_elliprg,
35-
elliprj as scipy_elliprj,
3631
betainc as scipy_betainc,
3732
)
3833

@@ -70,16 +65,6 @@
7065
TensorEllipe,
7166
ellipeinc,
7267
TensorEllipeinc,
73-
elliprc,
74-
TensorElliprc,
75-
elliprd,
76-
TensorElliprd,
77-
elliprf,
78-
TensorElliprf,
79-
elliprg,
80-
TensorElliprg,
81-
elliprj,
82-
TensorElliprj,
8368
)
8469

8570

@@ -432,6 +417,9 @@ def test_ellipeinc():
432417
reason="function not implemented in scipy.",
433418
)
434419
def test_elliprc():
420+
from scipy.special import elliprc as scipy_elliprc
421+
from ..ellip_func_integrals import elliprc, TensorElliprc
422+
435423
raw1 = np.random.rand(4, 3, 2)
436424
raw2 = np.random.rand(4, 3, 2)
437425
a = tensor(raw1, chunk_size=3)
@@ -457,6 +445,9 @@ def test_elliprc():
457445
reason="function not implemented in scipy.",
458446
)
459447
def test_elliprd():
448+
from scipy.special import elliprd as scipy_elliprd
449+
from ..ellip_func_integrals import elliprd, TensorElliprd
450+
460451
raw1 = np.random.rand(4, 3, 2)
461452
raw2 = np.random.rand(4, 3, 2)
462453
raw3 = np.random.rand(4, 3, 2)
@@ -484,6 +475,9 @@ def test_elliprd():
484475
reason="function not implemented in scipy.",
485476
)
486477
def test_elliprf():
478+
from scipy.special import elliprf as scipy_elliprf
479+
from ..ellip_func_integrals import elliprf, TensorElliprf
480+
487481
raw1 = np.random.rand(4, 3, 2)
488482
raw2 = np.random.rand(4, 3, 2)
489483
raw3 = np.random.rand(4, 3, 2)
@@ -511,6 +505,9 @@ def test_elliprf():
511505
reason="function not implemented in scipy.",
512506
)
513507
def test_elliprg():
508+
from scipy.special import elliprg as scipy_elliprg
509+
from ..ellip_func_integrals import elliprg, TensorElliprg
510+
514511
raw1 = np.random.rand(4, 3, 2)
515512
raw2 = np.random.rand(4, 3, 2)
516513
raw3 = np.random.rand(4, 3, 2)
@@ -538,6 +535,9 @@ def test_elliprg():
538535
reason="function not implemented in scipy.",
539536
)
540537
def test_elliprj():
538+
from scipy.special import elliprj as scipy_elliprj
539+
from ..ellip_func_integrals import elliprj, TensorElliprj
540+
541541
raw1 = np.random.rand(4, 3, 2)
542542
raw2 = np.random.rand(4, 3, 2)
543543
raw3 = np.random.rand(4, 3, 2)

0 commit comments

Comments
 (0)