def test_set_varm_key(adata):
    init_hash = joblib.hash(adata)

    orig_varm_val = adata.varm["o"].copy()
    subset_varm = adata[:, :50]
    assert subset_varm.is_view
    subset_varm.varm["o"] = np.ones((50, 20))
    assert not subset_varm.is_view
    assert np.all(adata.varm["o"] == orig_varm_val)

    assert init_hash == joblib.hash(adata)
def test_telemetry_imports_catboost(runner, live_mock_server, parse_ctx):
    with runner.isolated_filesystem():
        with mock.patch.dict("sys.modules", {"catboost": mock.Mock()}):
            import catboost

            run = wandb.init()
            run.finish()

            ctx_util = parse_ctx(live_mock_server.get_ctx())
            telemetry = ctx_util.telemetry

            # catboost in both init and finish modules
            assert telemetry and 7 in telemetry.get("1", [])
            assert telemetry and 7 in telemetry.get("2", [])