File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ tests/test_random.py::test_random_check_otput[random_sample]
30
30
tests/test_random.py::test_random_check_otput[randf]
31
31
tests/test_random.py::test_random_check_otput[sample]
32
32
tests/test_random.py::test_random_check_otput[rand]
33
+ tests/test_random.py::test_randn_normal_distribution
34
+ tests/test_random.py::test_radnom_seed[random]
35
+ tests/test_random.py::test_radnom_seed[random_sample]
36
+ tests/test_random.py::test_radnom_seed[randf]
37
+ tests/test_random.py::test_radnom_seed[sample]
38
+ tests/test_random.py::test_radnom_seed[rand]
33
39
tests/third_party/cupy/binary_tests/test_elementwise.py::TestElementwise::test_bitwise_and
34
40
tests/third_party/cupy/binary_tests/test_elementwise.py::TestElementwise::test_bitwise_or
35
41
tests/third_party/cupy/binary_tests/test_elementwise.py::TestElementwise::test_bitwise_xor
Original file line number Diff line number Diff line change 2
2
3
3
import dpnp .random
4
4
import numpy
5
-
5
+ # from scipy import stats
6
+ from numpy .testing import assert_array_equal
6
7
7
8
@pytest .mark .parametrize ("func" ,
8
9
[dpnp .random .rand ,
@@ -49,3 +50,36 @@ def test_random_check_otput(func):
49
50
for i in range (res .size ):
50
51
assert res [i ] >= 0.0
51
52
assert res [i ] < 1.0
53
+
54
+
55
+ def test_randn_normal_distribution ():
56
+ pts = 1000
57
+ alpha = 0.05
58
+ dpnp .random .seed (28041990 )
59
+ x = dpnp .random .randn (pts )
60
+ _ , p = stats .normaltest (x )
61
+ assert p > alpha
62
+
63
+
64
+ @pytest .mark .parametrize ("func" ,
65
+ [dpnp .random .random ,
66
+ dpnp .random .random_sample ,
67
+ dpnp .random .randf ,
68
+ dpnp .random .sample ,
69
+ dpnp .random .rand ],
70
+ ids = ['random' , 'random_sample' ,
71
+ 'randf' , 'sample' ,
72
+ 'rand' ])
73
+ def test_radnom_seed (func ):
74
+ seed = 28041990
75
+ size = 100
76
+ shape = (100 , 1 )
77
+ if func in [dpnp .random .rand , dpnp .random .randn ]:
78
+ args = size
79
+ else :
80
+ args = shape
81
+ dpnp .random .seed (seed )
82
+ a1 = func (args )
83
+ dpnp .random .seed (seed )
84
+ a2 = func (args )
85
+ assert_array_equal (a1 , a2 )
You can’t perform that action at this time.
0 commit comments