Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
prisae committed May 24, 2024
1 parent cae9eaf commit ae3f283
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resmda/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def rng(random=None):
"""
if isinstance(random, int):
return np.random.default_rng(int)
return np.random.default_rng(random)
elif isinstance(random, np.random.Generator):
return random
else:
Expand Down
Empty file removed tests/.keep
Empty file.
10 changes: 10 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import numpy as np

from resmda import utils


def test_random():
assert isinstance(utils.rng(), np.random.Generator)
assert isinstance(utils.rng(11), np.random.Generator)
rng = np.random.default_rng()
assert rng == utils.rng(rng)

0 comments on commit ae3f283

Please sign in to comment.