def test_invalid_scalar_index(adata, index):
    # https://github.com/theislab/anndata/issues/619
    with pytest.raises(IndexError, match=r".*index.* out of range\."):
        _ = adata[index]
def test_telemetry_imports_hf(runner, live_mock_server, parse_ctx):
    with runner.isolated_filesystem():
        run = wandb.init()

        with mock.patch.dict("sys.modules", {"transformers": mock.Mock()}):
            import transformers

            run.finish()

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

            # hf in finish modules but not in init modules
            assert telemetry and 11 not in telemetry.get("1", [])
            assert telemetry and 11 in telemetry.get("2", [])