Skip to content

Commit c4c6db4

Browse files
authored
Remove test/__init__.py (#298)
* set version * update * update * update * fix test * fix test
1 parent c86d777 commit c4c6db4

14 files changed

+29
-29
lines changed

test/__init__.py

Whitespace-only changes.

test/test_add.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import pytest
44
import torch
5-
from torch_sparse import SparseTensor, add
65

7-
from .utils import dtypes, devices, tensor
6+
from torch_sparse import SparseTensor, add
7+
from torch_sparse.testing import devices, dtypes, tensor
88

99

1010
@pytest.mark.parametrize('dtype,device', product(dtypes, devices))

test/test_cat.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import pytest
22
import torch
3-
from torch_sparse.tensor import SparseTensor
4-
from torch_sparse.cat import cat
53

6-
from .utils import devices, tensor
4+
from torch_sparse.cat import cat
5+
from torch_sparse.tensor import SparseTensor
6+
from torch_sparse.testing import devices, tensor
77

88

99
@pytest.mark.parametrize('device', devices)

test/test_diag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import pytest
44
import torch
5-
from torch_sparse.tensor import SparseTensor
65

7-
from .utils import dtypes, devices, tensor
6+
from torch_sparse.tensor import SparseTensor
7+
from torch_sparse.testing import devices, dtypes, tensor
88

99

1010
@pytest.mark.parametrize('dtype,device', product(dtypes, devices))

test/test_eye.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from itertools import product
22

33
import pytest
4-
from torch_sparse.tensor import SparseTensor
54

6-
from .utils import dtypes, devices
5+
from torch_sparse.tensor import SparseTensor
6+
from torch_sparse.testing import devices, dtypes
77

88

99
@pytest.mark.parametrize('dtype,device', product(dtypes, devices))

test/test_matmul.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
from torch_sparse.matmul import matmul
88
from torch_sparse.tensor import SparseTensor
9-
10-
from .utils import devices, grad_dtypes, reductions
9+
from torch_sparse.testing import devices, grad_dtypes, reductions
1110

1211

1312
@pytest.mark.parametrize('dtype,device,reduce',

test/test_metis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import pytest
44
import torch
5-
from torch_sparse.tensor import SparseTensor
65

7-
from .utils import devices
6+
from torch_sparse.tensor import SparseTensor
7+
from torch_sparse.testing import devices
88

99
try:
1010
rowptr = torch.tensor([0, 1])

test/test_permute.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import pytest
22
import torch
3-
from torch_sparse.tensor import SparseTensor
43

5-
from .utils import devices, tensor
4+
from torch_sparse.tensor import SparseTensor
5+
from torch_sparse.testing import devices, tensor
66

77

88
@pytest.mark.parametrize('device', devices)

test/test_spmm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import pytest
44
import torch
5-
from torch_sparse import spmm
65

7-
from .utils import dtypes, devices, tensor
6+
from torch_sparse import spmm
7+
from torch_sparse.testing import devices, dtypes, tensor
88

99

1010
@pytest.mark.parametrize('dtype,device', product(dtypes, devices))

test/test_spspmm.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
import torch
55

66
from torch_sparse import SparseTensor, spspmm
7-
8-
from .utils import devices, grad_dtypes, tensor
7+
from torch_sparse.testing import devices, grad_dtypes, tensor
98

109

1110
@pytest.mark.parametrize('dtype,device', product(grad_dtypes, devices))

test/test_storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import pytest
44
import torch
5-
from torch_sparse.storage import SparseStorage
65

7-
from .utils import dtypes, devices, tensor
6+
from torch_sparse.storage import SparseStorage
7+
from torch_sparse.testing import devices, dtypes, tensor
88

99

1010
@pytest.mark.parametrize('device', devices)

test/test_tensor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import pytest
44
import torch
5-
from torch_sparse import SparseTensor
65

7-
from .utils import grad_dtypes, devices
6+
from torch_sparse import SparseTensor
7+
from torch_sparse.testing import devices, grad_dtypes
88

99

1010
@pytest.mark.parametrize('dtype,device', product(grad_dtypes, devices))
@@ -15,8 +15,8 @@ def test_getitem(dtype, device):
1515
mat = torch.randn(m, n, dtype=dtype, device=device)
1616
mat = SparseTensor.from_dense(mat)
1717

18-
idx1 = torch.randint(0, m, (k,), dtype=torch.long, device=device)
19-
idx2 = torch.randint(0, n, (k,), dtype=torch.long, device=device)
18+
idx1 = torch.randint(0, m, (k, ), dtype=torch.long, device=device)
19+
idx2 = torch.randint(0, n, (k, ), dtype=torch.long, device=device)
2020
bool1 = torch.zeros(m, dtype=torch.bool, device=device)
2121
bool2 = torch.zeros(n, dtype=torch.bool, device=device)
2222
bool1.scatter_(0, idx1, 1)

test/test_transpose.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import pytest
44
import torch
5-
from torch_sparse import transpose
65

7-
from .utils import dtypes, devices, tensor
6+
from torch_sparse import transpose
7+
from torch_sparse.testing import devices, dtypes, tensor
88

99

1010
@pytest.mark.parametrize('dtype,device', product(dtypes, devices))

test/utils.py renamed to torch_sparse/testing.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Any
2+
13
import torch
24
import torch_scatter
35
from packaging import version
@@ -13,8 +15,8 @@
1315

1416
devices = [torch.device('cpu')]
1517
if torch.cuda.is_available():
16-
devices += [torch.device(f'cuda:{torch.cuda.current_device()}')]
18+
devices += [torch.device('cuda:0')]
1719

1820

19-
def tensor(x, dtype, device):
21+
def tensor(x: Any, dtype: torch.dtype, device: torch.device):
2022
return None if x is None else torch.tensor(x, dtype=dtype, device=device)

0 commit comments

Comments
 (0)