Skip to content

Commit 02a46a8

Browse files
authored
Merge pull request #103 from IntelPython/add-numpy-interface-tests
Add `interfaces.numpy_random` tests
2 parents 416b3e2 + 7298ec1 commit 02a46a8

File tree

7 files changed

+1695
-454
lines changed

7 files changed

+1695
-454
lines changed

.flake8

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extend-ignore =
66
D100,
77
# missing docstring in public class:
88
D101,
9-
# missing docstring in public method:
9+
# missing docstring in public function:
1010
D103,
1111
# missing docstring in public package:
1212
D104,
@@ -26,6 +26,7 @@ extend-ignore =
2626
per-file-ignores =
2727
mkl_random/__init__.py: F401
2828
mkl_random/interfaces/__init__.py: F401
29+
mkl_random/tests/**/*.py: D102
2930

3031
filename = *.py, *.pyx, *.pxi, *.pxd
3132
max_line_length = 80

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
* Added `mkl_random.interfaces` with `mkl_random.interfaces.numpy_random` interface, which aliases `mkl_random` functionality to more strictly adhere to NumPy's API (i.e., drops arguments and functions which are not part of standard NumPy) [gh-92](https://github.com/IntelPython/mkl_random/pull/92)
1313

14+
* Added third-party tests from `numpy.random` which tests the `mkl_random.interfaces.numpy_random` interface [gh-103](https://github.com/IntelPython/mkl_random/pull/103)
15+
16+
### Changed
17+
* Updates to `mkl_random` implementations to better align with newer versions of `numpy.random` [gh-103](https://github.com/IntelPython/mkl_random/pull/103)
18+
19+
### Fixed
20+
* Various bugfixes including a hang in `zipf` when called with `np.nan` and size-1 1D arrays being cast to scalars [gh-103](https://github.com/IntelPython/mkl_random/pull/103)
21+
1422
### Removed
1523
* Dropped support for Python 3.9 [gh-81](https://github.com/IntelPython/mkl_random/pull/81)
1624

mkl_random/interfaces/_numpy_random.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,18 @@ def exponential(self, scale=1.0, size=None):
281281
"""
282282
return super().exponential(scale=scale, size=size)
283283

284+
def tomaxint(self, size=None):
285+
"""
286+
tomaxint(size=None)
287+
288+
Return a sample of uniformly distributed random integers in the
289+
interval [0, ``np.iinfo("long").max``].
290+
291+
For full documentation refer to `numpy.random.RandomState.tomaxint`.
292+
293+
"""
294+
return super().tomaxint(size=size)
295+
284296
def standard_exponential(self, size=None):
285297
"""
286298
standard_exponential(size=None)
@@ -314,27 +326,29 @@ def gamma(self, shape, scale=1.0, size=None):
314326
"""
315327
return super().gamma(shape=shape, scale=scale, size=size)
316328

317-
def f(self, dfn, dfd, size=None):
329+
def f(self, dfnum, dfden, size=None):
318330
"""
319-
f(dfn, dfd, size=None)
331+
f(dfnum, dfden, size=None)
320332
321333
Draw samples from an F distribution.
322334
323335
For full documentation refer to `numpy.random.f`.
324336
325337
"""
326-
return super().f(dfn=dfn, dfd=dfd, size=size)
338+
return super().f(dfnum=dfnum, dfden=dfden, size=size)
327339

328-
def noncentral_f(self, dfn, dfd, nonc, size=None):
340+
def noncentral_f(self, dfnum, dfden, nonc, size=None):
329341
"""
330-
noncentral_f(dfn, dfd, nonc, size=None)
342+
noncentral_f(dfnum, dfden, nonc, size=None)
331343
332344
Draw samples from a non-central F distribution.
333345
334346
For full documentation refer to `numpy.random.noncentral_f`.
335347
336348
"""
337-
return super().noncentral_f(dfn=dfn, dfd=dfd, nonc=nonc, size=size)
349+
return super().noncentral_f(
350+
dfnum=dfnum, dfden=dfden, nonc=nonc, size=size
351+
)
338352

339353
def chisquare(self, df, size=None):
340354
"""

0 commit comments

Comments
 (0)