1
1
import pytest
2
+ from .helper import get_all_dtypes
2
3
3
4
import dpnp
4
5
5
6
import numpy
6
7
7
8
8
- @pytest .mark .parametrize ("kth" ,
9
- [0 , 1 ],
10
- ids = ['0' , '1' ])
11
- @pytest .mark .parametrize ("dtype" ,
12
- [numpy .float64 , numpy .float32 , numpy .int64 , numpy .int32 ],
13
- ids = ['float64' , 'float32' , 'int64' , 'int32' ])
14
- @pytest .mark .parametrize ("array" ,
15
- [[3 , 4 , 2 , 1 ],
16
- [[1 , 0 ], [3 , 0 ]],
17
- [[3 , 2 ], [1 , 6 ]],
18
- [[4 , 2 , 3 ], [3 , 4 , 1 ]],
19
- [[[1 , - 3 ], [3 , 0 ]], [[5 , 2 ], [0 , 1 ]], [[1 , 0 ], [0 , 1 ]]],
20
- [[[[8 , 2 ], [3 , 0 ]], [[5 , 2 ], [0 , 1 ]]], [[[1 , 3 ], [3 , 1 ]], [[5 , 2 ], [0 , 1 ]]]]],
21
- ids = ['[3, 4, 2, 1]' ,
22
- '[[1, 0], [3, 0]]' ,
23
- '[[3, 2], [1, 6]]' ,
24
- '[[4, 2, 3], [3, 4, 1]]' ,
25
- '[[[1, -3], [3, 0]], [[5, 2], [0, 1]], [[1, 0], [0, 1]]]' ,
26
- '[[[[8, 2], [3, 0]], [[5, 2], [0, 1]]], [[[1, 3], [3, 1]], [[5, 2], [0, 1]]]]' ])
9
+ @pytest .mark .parametrize ("kth" , [0 , 1 ], ids = ["0" , "1" ])
10
+ @pytest .mark .parametrize (
11
+ "dtype" , get_all_dtypes (no_bool = True , no_none = True , no_complex = True )
12
+ )
13
+ @pytest .mark .parametrize (
14
+ "array" ,
15
+ [
16
+ [3 , 4 , 2 , 1 ],
17
+ [[1 , 0 ], [3 , 0 ]],
18
+ [[3 , 2 ], [1 , 6 ]],
19
+ [[4 , 2 , 3 ], [3 , 4 , 1 ]],
20
+ [[[1 , - 3 ], [3 , 0 ]], [[5 , 2 ], [0 , 1 ]], [[1 , 0 ], [0 , 1 ]]],
21
+ [[[[8 , 2 ], [3 , 0 ]], [[5 , 2 ], [0 , 1 ]]], [[[1 , 3 ], [3 , 1 ]], [[5 , 2 ], [0 , 1 ]]]],
22
+ ],
23
+ ids = [
24
+ "[3, 4, 2, 1]" ,
25
+ "[[1, 0], [3, 0]]" ,
26
+ "[[3, 2], [1, 6]]" ,
27
+ "[[4, 2, 3], [3, 4, 1]]" ,
28
+ "[[[1, -3], [3, 0]], [[5, 2], [0, 1]], [[1, 0], [0, 1]]]" ,
29
+ "[[[[8, 2], [3, 0]], [[5, 2], [0, 1]]], [[[1, 3], [3, 1]], [[5, 2], [0, 1]]]]" ,
30
+ ],
31
+ )
27
32
def test_partition (array , dtype , kth ):
28
33
a = numpy .array (array , dtype )
29
34
ia = dpnp .array (array , dtype )
@@ -33,43 +38,42 @@ def test_partition(array, dtype, kth):
33
38
34
39
35
40
@pytest .mark .usefixtures ("allow_fall_back_on_numpy" )
36
- @pytest .mark .parametrize ("side" ,
37
- ["left" , "right" ],
38
- ids = ['"left"' , '"right"' ])
39
- @pytest .mark .parametrize ("v_" ,
40
- [
41
- [[3 , 4 ], [2 , 1 ]],
42
- [[1 , 0 ], [3 , 0 ]],
43
- [[3 , 2 , 1 , 6 ]],
44
- [[4 , 2 ], [3 , 3 ], [4 , 1 ]],
45
- [[1 , - 3 , 3 ], [0 , 5 , 2 ], [0 , 1 , 1 ], [0 , 0 , 1 ]],
46
- [[[[8 , 2 ], [3 , 0 ]], [[5 , 2 ], [0 , 1 ]]], [[[1 , 3 ], [3 , 1 ]], [[5 , 2 ], [0 , 1 ]]]]
47
- ],
48
- ids = [
49
- '[[3, 4], [2, 1]]' ,
50
- '[[1, 0], [3, 0]]' ,
51
- '[[3, 2, 1, 6]]' ,
52
- '[[4, 2], [3, 3], [4, 1]]' ,
53
- '[[1, -3, 3], [0, 5, 2], [0, 1, 1], [0, 0, 1]]' ,
54
- '[[[[8, 2], [3, 0]], [[5, 2], [0, 1]]], [[[1, 3], [3, 1]], [[5, 2], [0, 1]]]]'
55
- ])
56
- @pytest .mark .parametrize ("dtype" ,
57
- [numpy .float64 , numpy .float32 , numpy .int64 , numpy .int32 ],
58
- ids = ['float64' , 'float32' , 'int64' , 'int32' ])
59
- @pytest .mark .parametrize ("array" ,
60
- [
61
- [1 , 2 , 3 , 4 ],
62
- [- 5 , - 1 , 0 , 3 , 17 , 100 ]
63
- ],
64
- ids = [
65
- '[1, 2, 3, 4]' ,
66
- '[-5, -1, 0, 3, 17, 100]'
67
- # '[1, 0, 3, 0]',
68
- # '[3, 2, 1, 6]',
69
- # '[4, 2, 3, 3, 4, 1]',
70
- # '[1, -3, 3, 0, 5, 2, 0, 1, 1, 0, 0, 1]',
71
- # '[8, 2, 3, 0, 5, 2, 0, 1, 1, 3, 3, 1, 5, 2, 0, 1]'
72
- ])
41
+ @pytest .mark .parametrize ("side" , ["left" , "right" ], ids = ['"left"' , '"right"' ])
42
+ @pytest .mark .parametrize (
43
+ "v_" ,
44
+ [
45
+ [[3 , 4 ], [2 , 1 ]],
46
+ [[1 , 0 ], [3 , 0 ]],
47
+ [[3 , 2 , 1 , 6 ]],
48
+ [[4 , 2 ], [3 , 3 ], [4 , 1 ]],
49
+ [[1 , - 3 , 3 ], [0 , 5 , 2 ], [0 , 1 , 1 ], [0 , 0 , 1 ]],
50
+ [[[[8 , 2 ], [3 , 0 ]], [[5 , 2 ], [0 , 1 ]]], [[[1 , 3 ], [3 , 1 ]], [[5 , 2 ], [0 , 1 ]]]],
51
+ ],
52
+ ids = [
53
+ "[[3, 4], [2, 1]]" ,
54
+ "[[1, 0], [3, 0]]" ,
55
+ "[[3, 2, 1, 6]]" ,
56
+ "[[4, 2], [3, 3], [4, 1]]" ,
57
+ "[[1, -3, 3], [0, 5, 2], [0, 1, 1], [0, 0, 1]]" ,
58
+ "[[[[8, 2], [3, 0]], [[5, 2], [0, 1]]], [[[1, 3], [3, 1]], [[5, 2], [0, 1]]]]" ,
59
+ ],
60
+ )
61
+ @pytest .mark .parametrize (
62
+ "dtype" , get_all_dtypes (no_bool = True , no_none = True , no_complex = True )
63
+ )
64
+ @pytest .mark .parametrize (
65
+ "array" ,
66
+ [[1 , 2 , 3 , 4 ], [- 5 , - 1 , 0 , 3 , 17 , 100 ]],
67
+ ids = [
68
+ "[1, 2, 3, 4]" ,
69
+ "[-5, -1, 0, 3, 17, 100]"
70
+ # '[1, 0, 3, 0]',
71
+ # '[3, 2, 1, 6]',
72
+ # '[4, 2, 3, 3, 4, 1]',
73
+ # '[1, -3, 3, 0, 5, 2, 0, 1, 1, 0, 0, 1]',
74
+ # '[8, 2, 3, 0, 5, 2, 0, 1, 1, 3, 3, 1, 5, 2, 0, 1]'
75
+ ],
76
+ )
73
77
def test_searchsorted (array , dtype , v_ , side ):
74
78
a = numpy .array (array , dtype )
75
79
ia = dpnp .array (array , dtype )
0 commit comments