def test_cons_replacing():
    cons = HyCons("foo", "bar")
    cons[0] = "car"

    assert cons == HyCons("car", "bar")

    cons[1:] = "cdr"
    assert cons == HyCons("car", "cdr")

    try:
        cons[:] = "foo"
        assert True is False
    except IndexError:
        pass
Check that assigning to a cons works as expected
dataset/ETHPy150Open hylang/hy/tests/models/test_cons.py/test_cons_replacing