relational/test/update.py
Salvo 'LtWorf' Tomaselli a8c1b2a463 Revert copy on write optimization
In case of multiple renames, all of the resulting relations will point
to the same data, so writing on one and marking its only known copy
as writable would be incorrect.

For this to work, all the references should be kown to all the other
instances.

It is probably not worth to implement it.

Implemented test for the update
2015-11-18 12:15:03 +01:00

17 lines
404 B
Python

p1=people
p2=p1.rename({'id':'i'})
p2=p2.rename({'i':'id'})
assert p1==p2
assert p1._readonly
assert p2._readonly
# It is VERY important to not change the original relations
# or other tests might fail randomly, since the relations are
# only loaded once
p2.update('age==20', {'age':50})
assert p2._readonly == False
assert p1!=p2
p3 = p2.selection('age!=50')
p4 = p1.selection('age!=20')
assert p3==p4