Skip to content

Commit

Permalink
Warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed Apr 26, 2019
1 parent 8464701 commit 12105c4
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion anndata2ri/conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def full_converter() -> conversion.Converter:


def activate():
"""
r"""
Activate conversion for :class:`~anndata.AnnData` objects
as well as :doc:`numpy` arrays and :class:`pandas.DataFrame`\ s
via ``rpy2.robjects.numpy2ri`` and ``rpy2.robjects.pandas2ri``.
Expand Down
2 changes: 1 addition & 1 deletion anndata2ri/scipy2ri/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
r"""
Convert scipy.sparse matrices between Python and R.
For a detailed comparison between the two languages‘,
Expand Down
2 changes: 1 addition & 1 deletion anndata2ri/scipy2ri/py2r.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
def get_type_conv(dtype: np.dtype) -> Tuple[str, Callable[[np.ndarray], Sexp], Type[Vector]]:
if np.issubdtype(dtype, np.floating):
return "d", as_double, FloatVector
elif np.issubdtype(dtype, bool):
elif np.issubdtype(dtype, np.bool_):
return "l", as_logical, BoolVector
else:
raise ValueError(f"Unknown dtype {dtype!r} cannot be converted to ?gRMatrix.")
Expand Down
13 changes: 13 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[pytest]
# eventlet 0.24.1 imports dns.hash: https://github.com/eventlet/eventlet/pull/563
# igraph 0.7.1post6 imports SafeConfigParser: https://github.com/igraph/python-igraph/pull/203
# ipywidgets 7.4.2 imports ABCs from collections: https://github.com/jupyter-widgets/ipywidgets/pull/2395
# jinja2 2.10.1 imports ABCs from collections: https://github.com/pallets/jinja/pull/867
# rpy2 3.0.2 imports ABCs from collections: https://bitbucket.org/rpy2/rpy2/pull-requests/74/fix-deprecationwarning/diff
filterwarnings =
ignore::DeprecationWarning:dns.hash
ignore::DeprecationWarning:igraph.configuration
ignore::DeprecationWarning:ipywidgets.widgets.widget_selection
ignore::DeprecationWarning:jinja2.utils
ignore::DeprecationWarning:jinja2.runtime
ignore::DeprecationWarning:rpy2.rinterface_lib.sexp
6 changes: 5 additions & 1 deletion tests/test_py2rpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ def check_pca(ex):
@pytest.mark.parametrize("conversion", conversions_py2rpy)
@pytest.mark.parametrize("check,shape,dataset", datasets)
def test_py2rpy(conversion, check, shape, dataset):
ex = conversion(anndata2ri, dataset())
if dataset is sc.datasets.krumsiek11:
with pytest.warns(UserWarning, match=r"Duplicated obs_names"):
ex = conversion(anndata2ri, dataset())
else:
ex = conversion(anndata2ri, dataset())
assert tuple(baseenv["dim"](ex)[::-1]) == shape
check(ex)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_scipy_rpy2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

@pytest.mark.parametrize("conversion", conversions_rpy2py)
@pytest.mark.parametrize("shape,dataset,cls", mats)
def test_py2rpy(conversion, shape, dataset,cls):
def test_py2rpy(conversion, shape, dataset, cls):
sm = conversion(scipy2ri, dataset)
assert isinstance(sm, cls)
assert sm.shape == shape
Expand Down

0 comments on commit 12105c4

Please sign in to comment.