def test_weakref() -> None:
    """Classes with __slots__ are incompatible with the weakref module unless they
    explicitly state __weakref__ among their slots
    """
    from weakref import ref

    a = DataArray(1)
    r = ref(a)
    assert r() is a
Classes with __slots__ are incompatible with the weakref module unless they
    explicitly state __weakref__ among their slots
    
xarray/tests/test_dataarray.py