Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IO for nullable string arrays #1558

Merged
merged 29 commits into from
Aug 30, 2024

force coverage upload

d8297a0
Select commit
Loading
Failed to load commit list.
Merged

IO for nullable string arrays #1558

force coverage upload
d8297a0
Select commit
Loading
Failed to load commit list.
Azure Pipelines / scverse.anndata succeeded Aug 30, 2024 in 25m 49s

Build #20240830.12 had test failures

Details

Tests

  • Failed: 2 (0.01%)
  • Passed: 24,969 (86.08%)
  • Other: 4,037 (13.92%)
  • Total: 29,008
Code coverage

  • 5044 of 6011 lines covered (83.91%)

Annotations

Check failure on line 1 in test_concat_size_0_axis[obs-outer-only-no_var]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / scverse.anndata

test_concat_size_0_axis[obs-outer-only-no_var]

FutureWarning: Mismatched null-like values <NA> and nan found. In a future version, pandas equality-testing functions (e.g. assert_frame_equal) will consider these not-matching and raise.

Error raised from element 'obsm/df'.
Raw output
axis_name = 'obs', join_type = 'outer', merge_strategy = 'only', shape = (8, 0)

    @pytest.mark.parametrize(
        "shape", [pytest.param((8, 0), id="no_var"), pytest.param((0, 10), id="no_obs")]
    )
    def test_concat_size_0_axis(axis_name, join_type, merge_strategy, shape):
        """Regression test for https://github.com/scverse/anndata/issues/526"""
        axis, axis_name = merge._resolve_axis(axis_name)
        alt_axis = 1 - axis
        col_dtypes = (*DEFAULT_COL_TYPES, pd.StringDtype)
        a = gen_adata((5, 7), obs_dtypes=col_dtypes, var_dtypes=col_dtypes)
        b = gen_adata(shape, obs_dtypes=col_dtypes, var_dtypes=col_dtypes)
    
        expected_size = expected_shape(a, b, axis=axis, join=join_type)
    
        ctx_concat_empty = (
            pytest.warns(
                FutureWarning,
                match=r"The behavior of DataFrame concatenation with empty or all-NA entries is deprecated",
            )
            if shape[axis] == 0 and Version(pd.__version__) >= Version("2.1")
            else nullcontext()
        )
        with ctx_concat_empty:
            result = concat(
                {"a": a, "b": b},
                axis=axis,
                join=join_type,
                merge=merge_strategy,
                pairwise=True,
                index_unique="-",
            )
        assert result.shape == expected_size
    
        if join_type == "outer":
            # Check new entries along axis of concatenation
            axis_new_inds = axis_labels(result, axis).str.endswith("-b")
            altaxis_new_inds = ~axis_labels(result, alt_axis).isin(axis_labels(a, alt_axis))
            axis_idx = make_idx_tuple(axis_new_inds, axis)
            altaxis_idx = make_idx_tuple(altaxis_new_inds, 1 - axis)
    
            check_filled_like(result.X[axis_idx], elem_name="X")
            check_filled_like(result.X[altaxis_idx], elem_name="X")
            for k, elem in getattr(result, "layers").items():
                check_filled_like(elem[axis_idx], elem_name=f"layers/{k}")
                check_filled_like(elem[altaxis_idx], elem_name=f"layers/{k}")
    
            if shape[axis] > 0:
                b_result = result[axis_idx].copy()
                mapping_elem = f"{axis_name}m"
                setattr(b_result, f"{axis_name}_names", getattr(b, f"{axis_name}_names"))
                for k, result_elem in getattr(b_result, mapping_elem).items():
                    elem_name = f"{mapping_elem}/{k}"
                    # pd.concat can have unintuitive return types. is similar to numpy promotion
                    if isinstance(result_elem, pd.DataFrame):
>                       assert_equal(
                            getattr(b, mapping_elem)[k].astype(object),
                            result_elem.astype(object),
                            elem_name=elem_name,
                        )

tests/test_concatenate.py:1425: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/functools.py:907: in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/anndata/tests/helpers.py:633: in are_equal_dataframe
    report_name(pd.testing.assert_frame_equal)(
/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/anndata/tests/helpers.py:550: in func_wrapper
    raise e
/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/anndata/tests/helpers.py:539: in func_wrapper
    return func(*args, **kwargs)
testing.pyx:55: in pandas._libs.testing.assert_almost_equal
    ???
testing.pyx:160: in pandas._libs.testing.assert_almost_equal
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   FutureWarning: Mismatched null-like values <NA> and nan found. In a future version, pandas equality-testing functions (e.g. assert_frame_equal) will consider these not-matching and raise.
E  

Check failure on line 1 in test_size_of_view[layers-True]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / scverse.anndata

test_size_of_view[layers-True]

Test was limited to 1.5MiB but allocated 2.1MiB
Raw output
Test was limited to 1.5MiB but allocated 2.1MiB