Skip to content

Commit

Permalink
ENH: masked_array function returns a proper module (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdhaber authored Dec 1, 2024
1 parent f518a0f commit fd84308
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 3 additions & 4 deletions marray/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

__version__ = "0.0.4"

import types, sys
import dataclasses

def masked_array(xp):
Expand Down Expand Up @@ -195,10 +196,8 @@ def info(x):
else:
return xp.finfo(x.dtype)

class module:
pass

mod = module()
mod = types.ModuleType('mxp')
sys.modules['mxp'] = mod

mod.MaskedArray = MaskedArray

Expand Down
7 changes: 7 additions & 0 deletions marray/tests/test_marray.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,13 @@ def test_sorting(f_name, descending, stable, dtype, xp=strict, seed=None):
ref = np.ma.MaskedArray(ref_data, mask=ref_mask)
assert_equal(res, ref, seed)


def test_import(xp=np):
mxp = marray.masked_array(xp)
from mxp import asarray
asarray(10, mask=True)


def test_test():
seed = 149020664425889521094089537542803361848
# test_statistical_array('argmin', True, seed=seed)
Expand Down

0 comments on commit fd84308

Please sign in to comment.