from torchlinops import ANY, NamedDimCollection


def test_overwrite_any():
    old_shape = ("A", ANY, "C", ANY)
    new_shape = ("A", "B", "C", "D")
    ndc = NamedDimCollection(shape=old_shape)
    ndc["shape"] = new_shape
    assert ndc.shape == new_shape
    ndc["another_shape"] = ("E", "F")
    assert ndc.another_shape == ("E", "F")
