5
5
import numpy
6
6
7
7
8
- @pytest .mark .parametrize ("type" ,
9
- [numpy .float64 ],
10
- ids = ['float64' ])
11
- def test_amax_float64 (type ):
12
- a = numpy .array ([[[- 2. , 3. ], [9.1 , 0.2 ]], [[- 2. , 5.0 ], [- 2 , - 1.2 ]], [[1.0 , - 2. ], [5.0 , - 1.1 ]]])
8
+ @pytest .mark .parametrize ("type" , [numpy .float64 ], ids = [pytest .floatMAX ])
9
+ def test_amax_float (type ):
10
+ a = numpy .array (
11
+ [
12
+ [[- 2.0 , 3.0 ], [9.1 , 0.2 ]],
13
+ [[- 2.0 , 5.0 ], [- 2 , - 1.2 ]],
14
+ [[1.0 , - 2.0 ], [5.0 , - 1.1 ]],
15
+ ],
16
+ dtype = pytest .floatMAX ,
17
+ )
13
18
ia = dpnp .array (a )
14
19
15
20
for axis in range (len (a )):
@@ -18,9 +23,7 @@ def test_amax_float64(type):
18
23
numpy .testing .assert_array_equal (expected , result )
19
24
20
25
21
- @pytest .mark .parametrize ("type" ,
22
- [numpy .int64 ],
23
- ids = ['int64' ])
26
+ @pytest .mark .parametrize ("type" , [numpy .int64 ], ids = ["int64" ])
24
27
def test_amax_int (type ):
25
28
a = numpy .array ([1 , 0 , 2 , - 3 , - 1 , 2 , 21 , - 9 ])
26
29
ia = dpnp .array (a )
@@ -30,11 +33,16 @@ def test_amax_int(type):
30
33
numpy .testing .assert_array_equal (expected , result )
31
34
32
35
33
- @pytest .mark .parametrize ("type" ,
34
- [numpy .float64 ],
35
- ids = ['float64' ])
36
- def test_amin_float64 (type ):
37
- a = numpy .array ([[[- 2. , 3. ], [9.1 , 0.2 ]], [[- 2. , 5.0 ], [- 2 , - 1.2 ]], [[1.0 , - 2. ], [5.0 , - 1.1 ]]])
36
+ @pytest .mark .parametrize ("type" , [numpy .float64 ], ids = [pytest .floatMAX ])
37
+ def test_amin_float (type ):
38
+ a = numpy .array (
39
+ [
40
+ [[- 2.0 , 3.0 ], [9.1 , 0.2 ]],
41
+ [[- 2.0 , 5.0 ], [- 2 , - 1.2 ]],
42
+ [[1.0 , - 2.0 ], [5.0 , - 1.1 ]],
43
+ ],
44
+ dtype = pytest .floatMAX ,
45
+ )
38
46
ia = dpnp .array (a )
39
47
40
48
for axis in range (len (a )):
@@ -43,9 +51,7 @@ def test_amin_float64(type):
43
51
numpy .testing .assert_array_equal (expected , result )
44
52
45
53
46
- @pytest .mark .parametrize ("type" ,
47
- [numpy .int64 ],
48
- ids = ['int64' ])
54
+ @pytest .mark .parametrize ("type" , [numpy .int64 ], ids = ["int64" ])
49
55
def test_amin_int (type ):
50
56
a = numpy .array ([1 , 0 , 2 , - 3 , - 1 , 2 , 21 , - 9 ])
51
57
ia = dpnp .array (a )
@@ -68,12 +74,24 @@ def _get_min_max_input(type, shape):
68
74
69
75
70
76
@pytest .mark .usefixtures ("allow_fall_back_on_numpy" )
71
- @pytest .mark .parametrize ("type" ,
72
- [numpy .float64 , numpy .float32 , numpy .int64 , numpy .int32 ],
73
- ids = ['float64' , 'float32' , 'int64' , 'int32' ])
74
- @pytest .mark .parametrize ("shape" ,
75
- [(4 ,), (2 , 3 ), (4 , 5 , 6 )],
76
- ids = ['(4,)' , '(2,3)' , '(4,5,6)' ])
77
+ @pytest .mark .parametrize (
78
+ "type" ,
79
+ [
80
+ pytest .param (
81
+ numpy .float64 ,
82
+ marks = pytest .mark .skipif (
83
+ pytest .floatMAX != "float64" , reason = "No float64 support on this device"
84
+ ),
85
+ ),
86
+ numpy .float32 ,
87
+ numpy .int64 ,
88
+ numpy .int32 ,
89
+ ],
90
+ ids = ["float64" , "float32" , "int64" , "int32" ],
91
+ )
92
+ @pytest .mark .parametrize (
93
+ "shape" , [(4 ,), (2 , 3 ), (4 , 5 , 6 )], ids = ["(4,)" , "(2,3)" , "(4,5,6)" ]
94
+ )
77
95
def test_amax (type , shape ):
78
96
a = _get_min_max_input (type , shape )
79
97
@@ -89,12 +107,24 @@ def test_amax(type, shape):
89
107
90
108
91
109
@pytest .mark .usefixtures ("allow_fall_back_on_numpy" )
92
- @pytest .mark .parametrize ("type" ,
93
- [numpy .float64 , numpy .float32 , numpy .int64 , numpy .int32 ],
94
- ids = ['float64' , 'float32' , 'int64' , 'int32' ])
95
- @pytest .mark .parametrize ("shape" ,
96
- [(4 ,), (2 , 3 ), (4 , 5 , 6 )],
97
- ids = ['(4,)' , '(2,3)' , '(4,5,6)' ])
110
+ @pytest .mark .parametrize (
111
+ "type" ,
112
+ [
113
+ pytest .param (
114
+ numpy .float64 ,
115
+ marks = pytest .mark .skipif (
116
+ pytest .floatMAX != "float64" , reason = "No float64 support on this device"
117
+ ),
118
+ ),
119
+ numpy .float32 ,
120
+ numpy .int64 ,
121
+ numpy .int32 ,
122
+ ],
123
+ ids = ["float64" , "float32" , "int64" , "int32" ],
124
+ )
125
+ @pytest .mark .parametrize (
126
+ "shape" , [(4 ,), (2 , 3 ), (4 , 5 , 6 )], ids = ["(4,)" , "(2,3)" , "(4,5,6)" ]
127
+ )
98
128
def test_amin (type , shape ):
99
129
a = _get_min_max_input (type , shape )
100
130
0 commit comments