-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8114b20
commit e2d9012
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import unittest | ||
|
||
import numpy | ||
import pytest | ||
|
||
import dpnp as cupy | ||
from dpnp.tests.third_party.cupy import testing | ||
|
||
|
||
@testing.parameterize( | ||
*testing.product( | ||
{"shape": [(3,), (2, 3, 4), (0,), (0, 2), (3, 0)]}, | ||
) | ||
) | ||
class TestIter(unittest.TestCase): | ||
|
||
@testing.for_all_dtypes() | ||
@testing.numpy_cupy_array_equal() | ||
def test_list(self, xp, dtype): | ||
x = testing.shaped_arange(self.shape, xp, dtype) | ||
return list(x) | ||
|
||
@testing.for_all_dtypes() | ||
@testing.numpy_cupy_equal() | ||
def test_len(self, xp, dtype): | ||
x = testing.shaped_arange(self.shape, xp, dtype) | ||
return len(x) | ||
|
||
|
||
class TestIterInvalid(unittest.TestCase): | ||
|
||
@testing.for_all_dtypes() | ||
def test_iter(self, dtype): | ||
for xp in (numpy, cupy): | ||
x = testing.shaped_arange((), xp, dtype) | ||
with pytest.raises(TypeError): | ||
iter(x) | ||
|
||
@testing.for_all_dtypes() | ||
def test_len(self, dtype): | ||
for xp in (numpy, cupy): | ||
x = testing.shaped_arange((), xp, dtype) | ||
with pytest.raises(TypeError): | ||
len(x) |