def test_clone_not_deep(): a1 = W_NormalObject() b1 = W_NormalObject() a1.setvalue('b', b1) a2 = a1.clone() b2 = a2.getvalue('b') assert b1 is b2
def test_clone(): w1 = W_NormalObject() w1.setvalue('abc', W_Integer(6)) w2 = w1.clone() assert w2.getvalue('abc').value == 6 w2.setvalue('abc', W_Integer(99)) assert w2.getvalue('abc').value == 99 assert w1.getvalue('abc').value == 6 # still the old value